Class Clusters

java.lang.Object
edu.cmu.tetrad.data.Clusters
All Implemented Interfaces:
TetradSerializable, Serializable

public final class Clusters extends Object implements TetradSerializable
Stores clusters of variables for MimBuild, Purify, etc.
Author:
josephramsey, Ricardo Silva
See Also:
  • Constructor Details

    • Clusters

      public Clusters()
      Constructs a blank knowledge object.
    • Clusters

      public Clusters(Clusters clusters)
      Copy constructor.
  • Method Details

    • serializableInstance

      public static Clusters serializableInstance()
      Generates a simple exemplar of this class to test serialization.
    • addToCluster

      public void addToCluster(int index, String var)
      Adds 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)
    • getVarsNotInCluster

      public List<String> getVarsNotInCluster(List<String> varNames)
      Returns:
      the list of edges not in any tier.
    • getNumClusters

      public int getNumClusters()
      Returns:
      the number of measurement clusters for use in Purify and MIM Build. R. Silva (04/2003)
    • setNumClusters

      public void setNumClusters(int numClusters)
      Sets the number of clusters represented, or -1 if the number is allowed to vary.
    • getClusters

      public Map<String,Integer> getClusters()
      Returns:
      a copy of the cluster map, which is a map from variable names to integers.
    • getCluster

      public List<String> getCluster(int index)
      Parameters:
      index - the index of the desired index.
      Returns:
      a copy of this index.
    • getClusterName

      public String getClusterName(int index)
    • setClusterName

      public void setClusterName(int index, String name)
    • removeFromClusters

      public void removeFromClusters(String var)
      Removes the given variable from the clusters.
    • hashCode

      public int hashCode()
      Computes a hashcode.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the contents of this Knowledge object in String form.
    • isEmpty

      public boolean isEmpty()