mulan.classifier.meta
Class HMCNode

java.lang.Object
  extended by mulan.classifier.MultiLabelLearnerBase
      extended by mulan.classifier.meta.MultiLabelMetaLearner
          extended by mulan.classifier.meta.HMCNode
All Implemented Interfaces:
Serializable, MultiLabelLearner, TechnicalInformationHandler

public class HMCNode
extends MultiLabelMetaLearner

Class that implements a node for the HMC

Version:
0.2
Author:
George Saridis
See Also:
Serialized Form

Field Summary
 
Fields inherited from class mulan.classifier.meta.MultiLabelMetaLearner
baseLearner
 
Fields inherited from class mulan.classifier.MultiLabelLearnerBase
featureIndices, labelIndices, numLabels
 
Constructor Summary
HMCNode(String name, MultiLabelLearner mlc)
          Creates a new instance with the given name and learner
 
Method Summary
 void addChild(HMCNode child)
          Adds a child to the node.
protected  void buildInternal(MultiLabelInstances trainingSet)
          Learner specific implementation of building the model from MultiLabelInstances training data set.
 HashSet<HMCNode> getChildren()
          Returns the children of the current node
 ArrayList<String> getChildrenLabels()
          Returns a list of all children labels
 ArrayList<String> getDescendantLabels()
          Returns all descendant labels
 Instances getHeader()
          Returns the header information
 int[] getLabelIndices()
          Returns the label indices
 String getName()
          Returns the name of a node
 int getNumChildren()
          Returns the number of children
 TechnicalInformation getTechnicalInformation()
          Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
 String globalInfo()
          Returns a string describing the multi-label learner.
 boolean hasChildren()
          Checks whether the node has children
protected  MultiLabelOutput makePredictionInternal(Instance instance)
          Learner specific implementation for predicting on specified data based on trained model.
 
Methods inherited from class mulan.classifier.meta.MultiLabelMetaLearner
getBaseLearner
 
Methods inherited from class mulan.classifier.MultiLabelLearnerBase
build, debug, getDebug, isModelInitialized, isUpdatable, makeCopy, makePrediction, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HMCNode

public HMCNode(String name,
               MultiLabelLearner mlc)
        throws Exception
Creates a new instance with the given name and learner

Parameters:
name - name of the node
mlc - learner
Throws:
Exception
Method Detail

getLabelIndices

public int[] getLabelIndices()
Returns the label indices

Returns:
label indices

getHeader

public Instances getHeader()
Returns the header information

Returns:
header

buildInternal

protected void buildInternal(MultiLabelInstances trainingSet)
                      throws Exception
Description copied from class: MultiLabelLearnerBase
Learner specific implementation of building the model from MultiLabelInstances training data set. This method is called from MultiLabelLearnerBase.build(MultiLabelInstances) method, where behavior common across all learners is applied.

Specified by:
buildInternal in class MultiLabelLearnerBase
Parameters:
trainingSet - the training data set
Throws:
Exception - if learner model was not created successfully

makePredictionInternal

protected MultiLabelOutput makePredictionInternal(Instance instance)
                                           throws Exception
Description copied from class: MultiLabelLearnerBase
Learner specific implementation for predicting on specified data based on trained model. This method is called from MultiLabelLearnerBase.makePrediction(weka.core.Instance) which guards for model initialization and apply common handling/behavior.

Specified by:
makePredictionInternal in class MultiLabelLearnerBase
Parameters:
instance - the data instance to predict on
Returns:
the output of the learner for the given instance
Throws:
Exception - if an error occurs while making the prediction.
InvalidDataException - if specified instance data is invalid and can not be processed by the learner

hasChildren

public boolean hasChildren()
Checks whether the node has children

Returns:
whether the node has children

getNumChildren

public int getNumChildren()
Returns the number of children

Returns:
number of children

getChildren

public HashSet<HMCNode> getChildren()
Returns the children of the current node

Returns:
a set of nodes

getChildrenLabels

public ArrayList<String> getChildrenLabels()
Returns a list of all children labels

Returns:
list of children labels

getDescendantLabels

public ArrayList<String> getDescendantLabels()
Returns all descendant labels

Returns:
a list of descendant labels

addChild

public void addChild(HMCNode child)
Adds a child to the node.

Parameters:
child - - the child that will be added

getName

public String getName()
Returns the name of a node

Returns:
name of the node

getTechnicalInformation

public TechnicalInformation getTechnicalInformation()
Description copied from class: MultiLabelLearnerBase
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.

Specified by:
getTechnicalInformation in interface TechnicalInformationHandler
Specified by:
getTechnicalInformation in class MultiLabelLearnerBase
Returns:
the technical information about this class

globalInfo

public String globalInfo()
Description copied from class: MultiLabelLearnerBase
Returns a string describing the multi-label learner.

Specified by:
globalInfo in class MultiLabelLearnerBase
Returns:
a description suitable for displaying in a future gui