|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.ClassTree
ClassTree provides the hierarchy of classes according to a given encoding. The hierarchy is represented as tree resembling closely the tree of the given hierarchical structure.
Field Summary | |
static java.lang.String |
ATTRIBUTES_NULL_MESSAGE
Message for Exception if both attributes are null. |
private ClassTree[] |
children
The subtrees which are children of this node of the hierarchy. |
private static java.lang.String |
COMMA
Class separator in an tree encoding String or number separator in a range list. |
private java.lang.String[] |
leaves
The class-names directly coverd by this node of the hierarchy. |
Constructor Summary | |
ClassTree(ClassTree[] children)
Constructs a class-tree containing the given subtrees as children. |
|
ClassTree(java.lang.String[] classes)
Constructs a bottom-end class-tree containing only leaves. |
Method Summary | |
private java.lang.String |
createKey(Instances instanceInfo)
Provides a String as unique key for a ClassTree with respect to the given Instances. |
int |
depth()
Returns the depth of this ClassTree. |
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 ClassTree. |
Instances |
mergeClasses(Instances instances)
Returns a new Instances with classes merged to superclasses according to the superclasses of this ClassTree. |
Instances |
selectCoveredClasses(Instances data)
Returns the part of data covered by this hierarchy. |
void |
setChildren(ClassTree[] children)
Sets the children. |
void |
setLeaves(java.lang.String[] classes)
Sets the leaves. |
Instances[] |
splitForSuperClasses(Instances data)
Returns an array of Instances by splitting the given Instances with respect to the current superclasses. |
java.lang.String |
toString()
Returns a String-representation of this ClassTree readable by a ClassTreeParser . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final java.lang.String COMMA
public static final java.lang.String ATTRIBUTES_NULL_MESSAGE
private ClassTree[] children
leaves
is not null.
private java.lang.String[] leaves
children
is not null.
Constructor Detail |
public ClassTree(java.lang.String[] classes)
classes
- the classes to be contained by the new class-tree
as leavespublic ClassTree(ClassTree[] children)
children
- the class-trees to be children of this class-treeMethod Detail |
public ClassHierarchy[] getChildren()
getChildren
in interface ClassHierarchy
ClassHierarchy.getChildren()
public java.util.Map getChildren(Instances instanceInfo) throws java.lang.Exception
getChildren
in interface ClassHierarchy
instanceInfo
- the instanecs providing the classes
java.lang.Exception
- due to the use of filtersClassHierarchy.getChildren(Instances)
public java.lang.String[][] getCoveredClasses()
getCoveredClasses
in interface ClassHierarchy
ClassHierarchy.getCoveredClasses()
public java.lang.String[] getCoveredClassesFlat()
getCoveredClassesFlat
in interface ClassHierarchy
public Instances selectCoveredClasses(Instances data) throws java.lang.Exception
selectCoveredClasses
in interface ClassHierarchy
data
- to data to select from
java.lang.Exception
- due to use of filtersClassHierarchy.selectCoveredClasses(Instances)
private java.lang.String createKey(Instances instanceInfo) throws java.lang.Exception
instanceInfo
- the Instances to prepare a key for
java.lang.Exception
public Instances[] splitForSuperClasses(Instances data) throws java.lang.Exception
data
- the Instances to be split
java.lang.Exception
public Instance mergeClasses(Instance instance) throws java.lang.Exception
mergeClasses
in interface ClassHierarchy
instance
- the instance to merge the classes of
java.lang.Exception
- due to the use of filtersClassHierarchy.mergeClasses(weka.core.Instance)
public Instances mergeClasses(Instances instances) throws java.lang.Exception
mergeClasses
in interface ClassHierarchy
instances
- the instances to merge the classes of
java.lang.Exception
- due to the use of filtersClassHierarchy.mergeClasses(weka.core.Instances)
public java.lang.String toString()
ClassTreeParser
.
toString
in interface ClassHierarchy
ClassHierarchy.toString()
public int depth()
depth
in interface ClassHierarchy
ClassHierarchy.depth()
public void setChildren(ClassTree[] children)
children
- The children to setpublic void setLeaves(java.lang.String[] classes)
classes
- The leaves to set
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |