edu.stanford.nlp.cluster
Class VectorClusters

java.lang.Object
  |
  +--edu.stanford.nlp.cluster.AbstractSimpleClusters
        |
        +--edu.stanford.nlp.cluster.VectorClusters
All Implemented Interfaces:
Cloneable, Clusters, Serializable, SimpleClusters

public class VectorClusters
extends AbstractSimpleClusters
implements Clusters

Simple implementation of Clusters. Stores Clusters as a vector of Clusters.

See Also:
Serialized Form

Field Summary
protected  Vector clusters
           
 
Fields inherited from class edu.stanford.nlp.cluster.AbstractSimpleClusters
score
 
Constructor Summary
VectorClusters()
          constructs a Clusters
VectorClusters(int size)
          constructs a Clusters of given size
 
Method Summary
 boolean add(Cluster cluster)
          Adds cluster to Clusters
 void clearData()
          Clears the Data from all clusters
 Object clone()
          Returns deep copy of Clusters
 Cluster get(int index)
          Returns Cluster with index index
 double getScore()
          Returns score, if score has already been computed
 Iterator iterator()
          Returns an iterator of Clusters
 void logOddsTransform()
          transforms feature values to log-odds values, where the value of feature w in cluster z Value(w,z)=log2(P(w|z)/avg_over_clusters(P(w|z))).
 void merge(int i, int j)
          Merges clusters i and j by taking the weighted average of probability distributions over data and features (and adding the cluster probabilities) and stores the merged cluster into the slot with the lower index
 void reIndex()
          Re-indexes clusters.
 void remove(Cluster cluster)
          Removes Cluster cluster
 void removeElementAt(int index)
          Removes cluster at index index
 Cluster set(int index, Cluster cluster)
          Sets the value of index index to cluster
 void setSize(int size)
          Sets the the number of Clusters in Clusters
 int size()
          Returns number of clusters
 
Methods inherited from class edu.stanford.nlp.cluster.AbstractSimpleClusters
equals, evaluateInterSimilarity, pr_w_d, score, toString, toXMLString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.stanford.nlp.cluster.SimpleClusters
equals, evaluateInterSimilarity, pr_w_d, score, toString, toXMLString
 

Field Detail

clusters

protected Vector clusters
Constructor Detail

VectorClusters

public VectorClusters(int size)
constructs a Clusters of given size


VectorClusters

public VectorClusters()
constructs a Clusters

Method Detail

add

public boolean add(Cluster cluster)
Description copied from interface: Clusters
Adds cluster to Clusters

Specified by:
add in interface Clusters
Returns:
true if successful, false if not

get

public Cluster get(int index)
Description copied from interface: SimpleClusters
Returns Cluster with index index

Specified by:
get in interface SimpleClusters
Specified by:
get in class AbstractSimpleClusters

setSize

public void setSize(int size)
Description copied from interface: Clusters
Sets the the number of Clusters in Clusters

Specified by:
setSize in interface Clusters

set

public Cluster set(int index,
                   Cluster cluster)
Description copied from interface: Clusters
Sets the value of index index to cluster

Specified by:
set in interface Clusters

size

public int size()
Description copied from interface: SimpleClusters
Returns number of clusters

Specified by:
size in interface SimpleClusters
Specified by:
size in class AbstractSimpleClusters

removeElementAt

public void removeElementAt(int index)
Description copied from interface: Clusters
Removes cluster at index index

Specified by:
removeElementAt in interface Clusters

remove

public void remove(Cluster cluster)
Description copied from interface: Clusters
Removes Cluster cluster

Specified by:
remove in interface Clusters

iterator

public Iterator iterator()
Description copied from interface: SimpleClusters
Returns an iterator of Clusters

Specified by:
iterator in interface SimpleClusters
Specified by:
iterator in class AbstractSimpleClusters

reIndex

public void reIndex()
Description copied from interface: Clusters
Re-indexes clusters. Useful after removing a cluster.

Specified by:
reIndex in interface Clusters

clone

public Object clone()
Description copied from interface: SimpleClusters
Returns deep copy of Clusters

Specified by:
clone in interface SimpleClusters
Specified by:
clone in class AbstractSimpleClusters

getScore

public double getScore()
Description copied from interface: Clusters
Returns score, if score has already been computed

Specified by:
getScore in interface Clusters

merge

public void merge(int i,
                  int j)
Merges clusters i and j by taking the weighted average of probability distributions over data and features (and adding the cluster probabilities) and stores the merged cluster into the slot with the lower index

Specified by:
merge in interface Clusters

clearData

public void clearData()
Description copied from interface: Clusters
Clears the Data from all clusters

Specified by:
clearData in interface Clusters

logOddsTransform

public void logOddsTransform()
Description copied from interface: Clusters
transforms feature values to log-odds values, where the value of feature w in cluster z Value(w,z)=log2(P(w|z)/avg_over_clusters(P(w|z))).

Specified by:
logOddsTransform in interface Clusters


Stanford NLP Group