Package edu.cmu.tetrad.data
Class Clusters
java.lang.Object
edu.cmu.tetrad.data.Clusters
- All Implemented Interfaces:
- TetradSerializable,- Serializable
Stores clusters of variables for MimBuild, Purify, etc.
- Version:
- $Id: $Id
- Author:
- josephramsey, Ricardo Silva
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddToCluster(int index, String var) Adds the given variable to the given index.booleangetCluster(int index) getCluster.getClusterName(int index) getClusterName.Getter for the fieldclusters.intGetter for the fieldnumClusters.getVarsNotInCluster(List<String> varNames) getVarsNotInCluster.inthashCode()Computes a hashcode.booleanisEmpty()isEmpty.voidremoveFromClusters(String var) Removes the given variable from the clusters.static ClustersGenerates a simple exemplar of this class to test serialization.voidsetClusterName(int index, String name) setClusterName.voidsetNumClusters(int numClusters) Sets the number of clusters represented, or -1 if the number is allowed to vary.toString()toString.
- 
Constructor Details- 
Clusterspublic Clusters()Constructs a blank knowledge object.
- 
ClustersCopy constructor.- Parameters:
- clusters- the clusters to copy.
 
 
- 
- 
Method Details- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.- Returns:
- a simple exemplar of this class to test serialization.
 
- 
addToClusterAdds the given variable to the given index. If a variable which is being added is already in a index, it is moved to the new index. This information is used specifically by algorithm such as Purify and MIM Build. The first variation only put an Integer associated with the index, i.e., the clusterings forms a partition where the integer represents the index id for the corresponding variable. The second variation associates a list of Integers with each observed variable. When reading clustering information, one has to pay attention if the object retrieved is an Integer or a list of Integers.- Parameters:
- index- the index.
- var- the variable (a String name). R. Silva (04/2003)
 
- 
getVarsNotInClustergetVarsNotInCluster. - Parameters:
- varNames- the names of the variables.
- Returns:
- the list of edges not in any tier.
 
- 
getNumClusterspublic int getNumClusters()Getter for the field numClusters.- Returns:
- the number of measurement clusters for use in Purify and MIM Build. R. Silva (04/2003)
 
- 
setNumClusterspublic void setNumClusters(int numClusters) Sets the number of clusters represented, or -1 if the number is allowed to vary.- Parameters:
- numClusters- the number of clusters represented, or -1 if the number is allowed to vary.
 
- 
getClustersGetter for the field clusters.- Returns:
- a copy of the cluster map, which is a map from variable names to integers.
 
- 
getClustergetCluster. - Parameters:
- index- the index of the desired index.
- Returns:
- a copy of this index.
 
- 
getClusterNamegetClusterName. - Parameters:
- index- a int
- Returns:
- a Stringobject
 
- 
setClusterNamesetClusterName. - Parameters:
- index- a int
- name- a- Stringobject
 
- 
removeFromClustersRemoves the given variable from the clusters.- Parameters:
- var- the variable to remove.
 
- 
hashCodepublic int hashCode()Computes a hashcode.
- 
equalsCompares this object to another. 
- 
toStringtoString. 
- 
isEmptypublic boolean isEmpty()isEmpty. - Returns:
- true if there are no clusters, false otherwise.
 
 
-