Package cc.mallet.cluster
Class Clustering
- java.lang.Object
-
- cc.mallet.cluster.Clustering
-
- All Implemented Interfaces:
java.io.Serializable
public class Clustering extends java.lang.Object implements java.io.Serializable- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected InstanceListinstancesprotected int[]labelsprotected intnumLabels
-
Constructor Summary
Constructors Constructor Description Clustering(InstanceList instances, int numLabels, int[] labels)Clustering constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)InstanceListgetCluster(int label)Return an list of instances with a particular label.InstanceList[]getClusters()Returns an array of instance lists corresponding to clusters.int[]getIndicesWithLabel(int label)InstanceListgetInstances()intgetLabel(int index)Get the cluster label for a particular instance.int[]getLabels()intgetNumClusters()intgetNumInstances()voidsetLabel(int index, int label)Set the cluster label for a particular instance.voidsetNumLabels(int n)Set the number of clustersClusteringshallowCopy()intsize(int label)java.lang.StringtoString()
-
-
-
Field Detail
-
numLabels
protected int numLabels
-
labels
protected int[] labels
-
instances
protected InstanceList instances
-
-
Constructor Detail
-
Clustering
public Clustering(InstanceList instances, int numLabels, int[] labels)
Clustering constructor.- Parameters:
instances- Instances that are clusterednumLabels- Number of clusterslabels- Assignment of instances to clusters; many-to-one with range [0,numLabels).
-
-
Method Detail
-
getInstances
public InstanceList getInstances()
-
getCluster
public InstanceList getCluster(int label)
Return an list of instances with a particular label.
-
getClusters
public InstanceList[] getClusters()
Returns an array of instance lists corresponding to clusters.
-
getLabel
public int getLabel(int index)
Get the cluster label for a particular instance.
-
getLabels
public int[] getLabels()
-
getNumClusters
public int getNumClusters()
-
getNumInstances
public int getNumInstances()
-
size
public int size(int label)
-
getIndicesWithLabel
public int[] getIndicesWithLabel(int label)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
shallowCopy
public Clustering shallowCopy()
-
setLabel
public void setLabel(int index, int label)Set the cluster label for a particular instance.
-
setNumLabels
public void setNumLabels(int n)
Set the number of clusters
-
-