weka.classifiers.meta
Class ND

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.meta.ND
All Implemented Interfaces:
java.lang.Cloneable, NestedDichotomy, OptionHandler, Randomizable, java.io.Serializable

public class ND
extends Classifier
implements NestedDichotomy, OptionHandler

See Also:
Serialized Form

Nested Class Summary
protected  class ND.NDTree
           
 
Field Summary
protected  Classifier m_classifier
          The base classifier .
protected  java.util.Hashtable m_classifiers
          The hashtable containing all the classifiers
protected  boolean m_hashtablegiven
          Is Hashtable given from END?
protected  ND.NDTree m_ndtree
          The tree of classes
protected  int m_seed
          The random number seed used
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Constructor Summary
ND()
           
 
Method Summary
 void buildClassifier(Instances data)
          Builds the classifier.
 void buildClassifierForNode(ND.NDTree node, Instances data)
          Builds the classifier for one node.
 double[] distributionForInstance(Instance inst)
          Predicts the class distribution for a given instance
protected  double[] distributionForInstance(Instance inst, ND.NDTree node)
          Predicts the class distribution for a given instance
 Classifier getClassifier()
          Get the classifier used as the classifier
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 int getSeed()
          Gets the random number seed.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(java.lang.String[] argv)
          Main method for testing this class.
 void setClassifier(Classifier newClassifier)
          Set the base classifier.
 void setHashtable(java.util.Hashtable table)
          Set hashtable from END.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setSeed(int seed)
          Sets the seed for random number generation.
 java.lang.String toString()
          Outputs the classifier as a string.
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_ndtree

protected ND.NDTree m_ndtree
The tree of classes


m_classifiers

protected java.util.Hashtable m_classifiers
The hashtable containing all the classifiers


m_seed

protected int m_seed
The random number seed used


m_classifier

protected Classifier m_classifier
The base classifier .


m_hashtablegiven

protected boolean m_hashtablegiven
Is Hashtable given from END?

Constructor Detail

ND

public ND()
Method Detail

setHashtable

public void setHashtable(java.util.Hashtable table)
Set hashtable from END.


buildClassifier

public void buildClassifier(Instances data)
                     throws java.lang.Exception
Builds the classifier.

Specified by:
buildClassifier in class Classifier
Parameters:
data - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully

buildClassifierForNode

public void buildClassifierForNode(ND.NDTree node,
                                   Instances data)
                            throws java.lang.Exception
Builds the classifier for one node.

Throws:
java.lang.Exception

distributionForInstance

public double[] distributionForInstance(Instance inst)
                                 throws java.lang.Exception
Predicts the class distribution for a given instance

Overrides:
distributionForInstance in class Classifier
Parameters:
inst - the (multi-class) instance to be classified
Returns:
an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
Throws:
java.lang.Exception - if distribution could not be computed successfully

distributionForInstance

protected double[] distributionForInstance(Instance inst,
                                           ND.NDTree node)
                                    throws java.lang.Exception
Predicts the class distribution for a given instance

Parameters:
inst - the (multi-class) instance to be classified
Throws:
java.lang.Exception

setSeed

public void setSeed(int seed)
Sets the seed for random number generation.

Specified by:
setSeed in interface Randomizable
Parameters:
seed - the random number seed

getSeed

public int getSeed()
Gets the random number seed.

Specified by:
getSeed in interface Randomizable
Returns:
the random number seed

setClassifier

public void setClassifier(Classifier newClassifier)
Set the base classifier.

Parameters:
newClassifier - the Classifier to use.

getClassifier

public Classifier getClassifier()
Get the classifier used as the classifier

Returns:
the classifier used as the classifier

toString

public java.lang.String toString()
Outputs the classifier as a string.


listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class Classifier
Returns:
an enumeration of all the available options

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options. Valid options are:

-W classname
Specify the full class name of a learner as the basis for the multiclassclassifier (required).

-Q seed
Random number seed (default 1).

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - the options