Package moa.clusterers
Class CobWeb
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.clusterers.AbstractClusterer
-
- moa.clusterers.CobWeb
-
- All Implemented Interfaces:
Configurable
,Serializable
,Clusterer
,AWTRenderable
,MOAObject
,OptionHandler
public class CobWeb extends AbstractClusterer
Class implementing the Cobweb and Classit clustering algorithms. See: http://en.wikipedia.org/wiki/Cobweb_%28clustering%29 Citation: D. Fisher (1987). Knowledge acquisition via incremental conceptual clustering. Machine Learning. 2(2):139-172.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description FloatOption
acuityOption
static String
classifierPurposeString
FloatOption
cutoffOption
protected double
m_acuity
Acuity (minimum standard deviation).protected moa.clusterers.CobWeb.CNode
m_cobwebTree
Holds the root of the Cobweb tree.protected double
m_cutoff
Cutoff (minimum category utility).protected static double
m_normal
Normal constant.protected int
m_numberMerges
the number of merges that happenedprotected int
m_numberOfClusters
Number of clusters (nodes in the tree).protected boolean
m_numberOfClustersDetermined
whether the number of clusters was already determinedprotected int
m_numberSplits
the number of splits that happenedprotected boolean
m_saveInstances
Output instances in graph representation of Cobweb tree (Allows instances at nodes in the tree to be visualized in the Explorer).IntOption
randomSeedOption
-
Fields inherited from class moa.clusterers.AbstractClusterer
clustererRandom, clustering, evaluateMicroClusteringOption, modelContext, randomSeed, trainingWeightSeenByModel
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description CobWeb()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
determineNumberOfClusters()
determines the number of clusters if necessarydouble
getAcuity()
get the acuity valueClustering
getClusteringResult()
double
getCutoff()
get the cutoffvoid
getModelDescription(StringBuilder out, int indent)
protected Measurement[]
getModelMeasurementsImpl()
boolean
getSaveInstanceData()
Get the value of saveInstances.double[]
getVotesForInstance(Instance instance)
Classifies a given instance.String
graph()
Generates the graph string of the Cobweb treeboolean
isRandomizable()
int
numberOfClusters()
Returns the number of clusters.void
resetLearningImpl()
void
setAcuity(double a)
set the acuity.void
setCutoff(double c)
set the cutoffvoid
setSaveInstanceData(boolean newsaveInstances)
Set the value of saveInstances.void
trainOnInstanceImpl(Instance newInstance)
Adds an instance to the clusterer.-
Methods inherited from class moa.clusterers.AbstractClusterer
adjustParameters, contextIsCompatible, copy, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getMicroClusteringResult, getModelContext, getModelMeasurements, getNominalValueString, getPurposeString, getSubClusterers, implementsMicroClusterer, keepClassLabel, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setModelContext, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance
-
Methods inherited from class moa.options.AbstractOptionHandler
getCLICreationString, getOptions, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
-
Methods inherited from class moa.AbstractMOAObject
copy, measureByteSize, measureByteSize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface moa.MOAObject
measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
getCLICreationString, getOptions, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
acuityOption
public FloatOption acuityOption
-
cutoffOption
public FloatOption cutoffOption
-
randomSeedOption
public IntOption randomSeedOption
-
m_normal
protected static final double m_normal
Normal constant.
-
m_acuity
protected double m_acuity
Acuity (minimum standard deviation).
-
m_cutoff
protected double m_cutoff
Cutoff (minimum category utility).
-
m_cobwebTree
protected moa.clusterers.CobWeb.CNode m_cobwebTree
Holds the root of the Cobweb tree.
-
m_numberOfClusters
protected int m_numberOfClusters
Number of clusters (nodes in the tree). Must never be queried directly, only via the method numberOfClusters(). Otherwise it's not guaranteed that it contains the correct value.- See Also:
numberOfClusters()
,m_numberOfClustersDetermined
-
m_numberOfClustersDetermined
protected boolean m_numberOfClustersDetermined
whether the number of clusters was already determined
-
m_numberSplits
protected int m_numberSplits
the number of splits that happened
-
m_numberMerges
protected int m_numberMerges
the number of merges that happened
-
m_saveInstances
protected boolean m_saveInstances
Output instances in graph representation of Cobweb tree (Allows instances at nodes in the tree to be visualized in the Explorer).
-
classifierPurposeString
public static final String classifierPurposeString
- See Also:
- Constant Field Values
-
-
Method Detail
-
resetLearningImpl
public void resetLearningImpl()
- Specified by:
resetLearningImpl
in classAbstractClusterer
-
trainOnInstanceImpl
public void trainOnInstanceImpl(Instance newInstance)
Adds an instance to the clusterer.- Specified by:
trainOnInstanceImpl
in classAbstractClusterer
- Parameters:
newInstance
- the instance to be added- Throws:
Exception
- if something goes wrong
-
getVotesForInstance
public double[] getVotesForInstance(Instance instance)
Classifies a given instance.- Parameters:
instance
- the instance to be assigned to a cluster- Returns:
- the number of the assigned cluster as an interger if the class is enumerated, otherwise the predicted value
- Throws:
Exception
- if instance could not be classified successfully
-
determineNumberOfClusters
protected void determineNumberOfClusters()
determines the number of clusters if necessary- See Also:
m_numberOfClusters
,m_numberOfClustersDetermined
-
numberOfClusters
public int numberOfClusters()
Returns the number of clusters.- Returns:
- the number of clusters
-
getModelMeasurementsImpl
protected Measurement[] getModelMeasurementsImpl()
- Specified by:
getModelMeasurementsImpl
in classAbstractClusterer
-
getModelDescription
public void getModelDescription(StringBuilder out, int indent)
- Specified by:
getModelDescription
in classAbstractClusterer
-
isRandomizable
public boolean isRandomizable()
-
graph
public String graph()
Generates the graph string of the Cobweb tree- Returns:
- a
String
value - Throws:
Exception
- if an error occurs
-
setAcuity
public void setAcuity(double a)
set the acuity.- Parameters:
a
- the acuity value
-
getAcuity
public double getAcuity()
get the acuity value- Returns:
- the acuity
-
setCutoff
public void setCutoff(double c)
set the cutoff- Parameters:
c
- the cutof
-
getCutoff
public double getCutoff()
get the cutoff- Returns:
- the cutoff
-
getSaveInstanceData
public boolean getSaveInstanceData()
Get the value of saveInstances.- Returns:
- Value of saveInstances.
-
setSaveInstanceData
public void setSaveInstanceData(boolean newsaveInstances)
Set the value of saveInstances.- Parameters:
newsaveInstances
- Value to assign to saveInstances.
-
getClusteringResult
public Clustering getClusteringResult()
-
-