cc.mallet.cluster
Class Clustering

java.lang.Object
  extended by 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
protected  InstanceList instances
           
protected  int[] labels
           
protected  int numLabels
           
 
Constructor Summary
Clustering(InstanceList instances, int numLabels, int[] labels)
          Clustering constructor.
 
Method Summary
 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 clusters
 Clustering shallowCopy()
           
 int size(int label)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 clustered
numLabels - Number of clusters
labels - 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 class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.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