weka.core
Interface ClassHierarchy

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
ClassTree

public interface ClassHierarchy
extends java.io.Serializable

Interface for representations of a hierarchy of classes.

Author:
Arthur Zimek

Method Summary
 int depth()
          Returns the depth of the Hierarchy.
 ClassHierarchy[] getChildren()
          Returns the hierarchy of classes as given by the children.
 java.util.Map getChildren(Instances instanceInfo)
          Returns the childrenHierarchies as Map.
 java.lang.String[][] getCoveredClasses()
          Returns the classes covered by this hierarchy splitted into several arrays according to their distribution into several superclasses (reflecting the distribution on several children of this hierarchy).
 java.lang.String[] getCoveredClassesFlat()
          Returns the class-names covered by this node of the hierarchy.
 Instance mergeClasses(Instance instance)
          Returns a new Instance with classes selected and merged to superclasses according to the superclasses of this hierarchy.
 Instances mergeClasses(Instances instances)
          Returns a new Instances with classes merged to superclasses according to the superclasses of this hierarchy.
 Instances selectCoveredClasses(Instances data)
          Returns the part of data covered by this hierarchy.
 java.lang.String toString()
          Returns a String-representation of this Hierarchy.
 

Method Detail

getChildren

public ClassHierarchy[] getChildren()
Returns the hierarchy of classes as given by the children.

Returns:
ClassHierarchy[] an array containing for each child the hierarchy given under this child respectively an array of length zero for a leaf

getChildren

public java.util.Map getChildren(Instances instanceInfo)
                          throws java.lang.Exception
Returns the childrenHierarchies as Map. A key of String equal to a superclass-attribute-value of instanceInfo after merging the classes is mapped to the according child-hierarchy.

Parameters:
instanceInfo - the instanecs providing the classes
Returns:
Map a mapping of Strings equal to a superclass-attribute-value of instanceInfo after merging the classes to the according child-hierarchy
Throws:
java.lang.Exception - due to the use of filters

selectCoveredClasses

public Instances selectCoveredClasses(Instances data)
                               throws java.lang.Exception
Returns the part of data covered by this hierarchy. The classes not to be contained by the result are supposed to be removed from the returned data's header.

Parameters:
data - to data to select from
Returns:
Instances the selected data
Throws:
java.lang.Exception - due to use of filters

mergeClasses

public Instance mergeClasses(Instance instance)
                      throws java.lang.Exception
Returns a new Instance with classes selected and merged to superclasses according to the superclasses of this hierarchy.

Parameters:
instance - the instance to merge the classes of
Returns:
Instance a new Instance with classes merged to superclasses according to the superclasses of this hierarchy
Throws:
java.lang.Exception - due to the use of filters

mergeClasses

public Instances mergeClasses(Instances instances)
                       throws java.lang.Exception
Returns a new Instances with classes merged to superclasses according to the superclasses of this hierarchy.

Parameters:
instances - the instances to merge the classes of
Returns:
Instances a new Instances with classes merged to superclasses according to the superclasses of this hierarchy
Throws:
java.lang.Exception - due to the use of filters

toString

public java.lang.String toString()
Returns a String-representation of this Hierarchy.

Returns:
String a String-representation of this Hierarchy

depth

public int depth()
Returns the depth of the Hierarchy.

Returns:
int the depth of this Hierarchy

getCoveredClasses

public java.lang.String[][] getCoveredClasses()
Returns the classes covered by this hierarchy splitted into several arrays according to their distribution into several superclasses (reflecting the distribution on several children of this hierarchy).

Returns:
String[][] the classes covered by this hierarchy splitted according to their distribution into superclasses - the first index reflecting the superclass-index, the second gives the specific class (not reflecting the class-index in Instances).

getCoveredClassesFlat

public java.lang.String[] getCoveredClassesFlat()
Returns the class-names covered by this node of the hierarchy.

Returns:
String[] the class-names covered by this node of the hierarchy