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 InstanceList
instances
protected int[]
labels
protected int
numLabels
-
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 boolean
equals(java.lang.Object o)
InstanceList
getCluster(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)
InstanceList
getInstances()
int
getLabel(int index)
Get the cluster label for a particular instance.int[]
getLabels()
int
getNumClusters()
int
getNumInstances()
void
setLabel(int index, int label)
Set the cluster label for a particular instance.void
setNumLabels(int n)
Set the number of clustersClustering
shallowCopy()
int
size(int label)
java.lang.String
toString()
-
-
-
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:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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
-
-