weka.experiment.DensityBasedClustererSplitEvaluator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weka-dev Show documentation
Show all versions of weka-dev Show documentation
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* DensityBasedClustererSplitEvaluator.java
* Copyright (C) 2008-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.experiment;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
import weka.clusterers.AbstractClusterer;
import weka.clusterers.ClusterEvaluation;
import weka.clusterers.DensityBasedClusterer;
import weka.clusterers.EM;
import weka.core.AdditionalMeasureProducer;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionHandler;
import weka.core.RevisionUtils;
import weka.core.Utils;
import weka.filters.Filter;
import weka.filters.unsupervised.attribute.Remove;
/**
* A SplitEvaluator that produces results for a
* density based clusterer.
*
*
*
* Valid options are:
*
*
*
* -no-size
* Skips the determination of sizes (train/test/clusterer)
* (default: sizes are determined)
*
*
*
* -W <class name>
* The full class name of the density based clusterer.
* eg: weka.clusterers.EM
*
*
*
* Options specific to clusterer weka.clusterers.EM:
*
*
*
* -N <num>
* number of clusters. If omitted or -1 specified, then
* cross validation is used to select the number of clusters.
*
*
*
* -I <num>
* max iterations.
* (default 100)
*
*
*
* -V
* verbose.
*
*
*
* -M <num>
* minimum allowable standard deviation for normal density
* computation
* (default 1e-6)
*
*
*
* -O
* Display model in old format (good when there are many clusters)
*
*
*
* -S <num>
* Random number seed.
* (default 100)
*
*
*
*
* All options after -- will be passed to the clusterer.
*
* @author Mark Hall (mhall{[at]}pentaho{[dot]}org
* @version $Revision: 11323 $
*/
public class DensityBasedClustererSplitEvaluator implements SplitEvaluator,
OptionHandler, AdditionalMeasureProducer, RevisionHandler {
/** for serialization. */
private static final long serialVersionUID = 5124501059135692160L;
/** Remove the class column (if set) from the data */
protected boolean m_removeClassColumn = true;
/** The clusterer used for evaluation */
protected DensityBasedClusterer m_clusterer = new EM();
/** Holds the most recently used ClusterEvaluation object */
protected ClusterEvaluation m_Evaluation;
/** The names of any additional measures to look for in SplitEvaluators */
protected String[] m_additionalMeasures = null;
/**
* Array of booleans corresponding to the measures in m_AdditionalMeasures
* indicating which of the AdditionalMeasures the current clusterer can
* produce
*/
protected boolean[] m_doesProduce = null;
/**
* The number of additional measures that need to be filled in after taking
* into account column constraints imposed by the final destination for
* results
*/
protected int m_numberAdditionalMeasures = 0;
/** Holds the statistics for the most recent application of the clusterer */
protected String m_result = null;
/** The clusterer options (if any) */
protected String m_clustererOptions = "";
/** The clusterer version */
protected String m_clustererVersion = "";
/** whether to skip determination of sizes (train/test/classifier). */
protected boolean m_NoSizeDetermination;
/** The length of a key */
private static final int KEY_SIZE = 3;
/** The length of a result */
private static final int RESULT_SIZE = 9;
public DensityBasedClustererSplitEvaluator() {
updateOptions();
}
/**
* Returns a string describing this split evaluator
*
* @return a description of the split evaluator suitable for displaying in the
* explorer/experimenter gui
*/
public String globalInfo() {
return " A SplitEvaluator that produces results for a density based clusterer. ";
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
@Override
public Enumeration
© 2015 - 2024 Weber Informatics LLC | Privacy Policy