|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.meta.TreeBasedMultiClassClassifier
Class that represents and builds a classifier tree.
Field Summary | |
protected Classifier |
m_Classifier
The classifier at this node. |
protected boolean |
m_ClassIsOrdinal
Whether class is ordinal |
(package private) Instances |
m_Data
|
protected MakeIndicator |
m_Filter
The filter used at this node |
protected TreeBasedMultiClassClassifier |
m_FirstSuccessor
The first successor |
protected java.util.Random |
m_Random
The random number generator. |
protected Range |
m_Range
The classes that are grouped together at the current node |
protected TreeBasedMultiClassClassifier |
m_SecondSuccessor
The second successor |
protected int |
m_Seed
Random number seed |
protected boolean |
m_UseRandomSelection
Whether to split classes randomly |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
Constructor Summary | |
TreeBasedMultiClassClassifier()
|
Method Summary | |
void |
buildClassifier(Instances data)
Builds tree recursively |
double[] |
distributionForInstance(Instance inst)
Predicts the class distribution for a given instance * * @param inst the (multi-class) instance to be classified |
private void |
generateClassifierForNode(Instances data,
Range classes,
java.util.Random rand,
Classifier classifier,
boolean random,
boolean ordinal)
Generates a classifier for the current node and proceeds recursively |
Classifier |
getClassifier()
Get the classifier used as the classifier * * @return the classifier used as the classifier |
boolean |
getClassOrdinal()
Get whether class is ordinal. |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier |
boolean |
getRandomSelection()
Get whether to perform a random selection. |
int |
getSeed()
Gets the random number seed |
java.lang.String |
globalInfo()
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options * * @return an enumeration of all 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 |
setClassOrdinal(boolean v)
Set whether class is ordinal. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRandomSelection(boolean v)
Set whether to perform a random selection. |
void |
setSeed(int seed)
Sets the seed for random number generation |
java.lang.String |
toString()
Outputs the classifier as a string. |
private int |
treeToString(java.lang.StringBuffer text,
int nn)
Returns string description of the tree. |
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 |
protected Classifier m_Classifier
protected MakeIndicator m_Filter
protected TreeBasedMultiClassClassifier m_FirstSuccessor
protected TreeBasedMultiClassClassifier m_SecondSuccessor
protected java.util.Random m_Random
protected Range m_Range
protected boolean m_UseRandomSelection
protected boolean m_ClassIsOrdinal
protected int m_Seed
Instances m_Data
Constructor Detail |
public TreeBasedMultiClassClassifier()
Method Detail |
private void generateClassifierForNode(Instances data, Range classes, java.util.Random rand, Classifier classifier, boolean random, boolean ordinal) throws java.lang.Exception
java.lang.Exception
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- set of instances serving as training data
java.lang.Exception
- if the classifier has not been
generated successfullypublic double[] distributionForInstance(Instance inst) throws java.lang.Exception
distributionForInstance
in class Classifier
inst
- the instance to be classified
java.lang.Exception
- if distribution could not be
computed successfullypublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
*
* -M
* Sets whether Sets whether class is ordinal (default: nominal).
*
* -R
* Sets whether selection is random (default: deterministic)
*
* -W classname
* Specify the full class name of a learner as the basis for
* the multiclassclassifier (required).
*
* -Q seed
* Random number seed (default 1).
* * @param options the list of options as an array of strings * @exception Exception if an option is not supported
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String globalInfo()
public void setRandomSelection(boolean v)
public boolean getRandomSelection()
public void setClassOrdinal(boolean v)
public boolean getClassOrdinal()
public void setSeed(int seed)
setSeed
in interface Randomizable
seed
- the seedpublic int getSeed()
getSeed
in interface Randomizable
public void setClassifier(Classifier newClassifier)
public Classifier getClassifier()
public java.lang.String toString()
private int treeToString(java.lang.StringBuffer text, int nn)
public static void main(java.lang.String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |