|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.trees.RandomTree
Class for constructing a tree that considers K random features at each node. Performs no pruning.
| Field Summary | |
protected int |
m_Attribute
The attribute to split on. |
protected double[] |
m_ClassProbs
Class probabilities from the training data. |
protected boolean |
m_Debug
Debug info |
protected double[][] |
m_Distribution
The class distribution from the training data. |
protected Instances |
m_Info
The header information. |
protected int |
m_KValue
The number of attributes considered for a split. |
protected double |
m_MinNum
Minimum number of instances for leaf. |
protected double[] |
m_Prop
The proportions of training instances going down each branch. |
protected int |
m_randomSeed
The random seed to use. |
protected double |
m_SplitPoint
The split point. |
protected RandomTree[] |
m_Successors
The subtrees appended to this tree. |
| Constructor Summary | |
RandomTree()
|
|
| Method Summary | |
void |
buildClassifier(Instances data)
Builds classifier. |
protected void |
buildTree(int[][] sortedIndices,
double[][] weights,
Instances data,
double[] classProbs,
Instances header,
double minNum,
boolean debug,
int[] attIndicesWindow,
java.util.Random random)
Recursively generates a tree. |
java.lang.String |
debugTipText()
Returns the tip text for this property |
protected double |
distribution(double[][] props,
double[][][] dists,
int att,
int[] sortedIndices,
double[] weights,
Instances data)
Computes class distribution for an attribute. |
double[] |
distributionForInstance(Instance instance)
Computes class distribution of an instance using the decision tree. |
protected double |
gain(double[][] dist,
double priorVal)
Computes value of splitting criterion after split. |
boolean |
getDebug()
Get the value of Debug. |
int |
getKValue()
Get the value of K. |
double |
getMinNum()
Get the value of MinNum. |
java.lang.String[] |
getOptions()
Gets options from this classifier. |
int |
getSeed()
Gets the seed for the random number generations |
java.lang.String |
globalInfo()
Returns a string describing classifier |
java.lang.String |
KValueTipText()
Returns the tip text for this property |
protected java.lang.String |
leafString()
Outputs a leaf. |
java.util.Enumeration |
listOptions()
Lists the command-line options for this classifier. |
static void |
main(java.lang.String[] argv)
Main method for this class. |
java.lang.String |
minNumTipText()
Returns the tip text for this property |
int |
numNodes()
Computes size of the tree. |
protected double |
priorVal(double[][] dist)
Computes value of splitting criterion before split. |
java.lang.String |
seedTipText()
Returns the tip text for this property |
void |
setDebug(boolean newDebug)
Set the value of Debug. |
void |
setKValue(int k)
Set the value of K. |
void |
setMinNum(double newMinNum)
Set the value of MinNum. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setSeed(int seed)
Set the seed for random number generation. |
protected void |
splitData(int[][][] subsetIndices,
double[][][] subsetWeights,
int att,
double splitPoint,
int[][] sortedIndices,
double[][] weights,
double[][] dist,
Instances data)
Splits instances into subsets. |
java.lang.String |
toGraph()
Outputs the decision tree as a graph |
int |
toGraph(java.lang.StringBuffer text,
int num)
Outputs one node for graph. |
java.lang.String |
toString()
Outputs the decision tree. |
protected java.lang.String |
toString(int level)
Recursively outputs the tree. |
| Methods inherited from class weka.classifiers.Classifier |
classifyInstance, forName, makeCopies |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected RandomTree[] m_Successors
protected int m_Attribute
protected double m_SplitPoint
protected double[][] m_Distribution
protected Instances m_Info
protected double[] m_Prop
protected double[] m_ClassProbs
protected double m_MinNum
protected boolean m_Debug
protected int m_KValue
protected int m_randomSeed
| Constructor Detail |
public RandomTree()
| Method Detail |
public java.lang.String globalInfo()
public java.lang.String minNumTipText()
public double getMinNum()
public void setMinNum(double newMinNum)
newMinNum - Value to assign to MinNum.public java.lang.String KValueTipText()
public int getKValue()
public void setKValue(int k)
k - Value to assign to K.public java.lang.String debugTipText()
debugTipText in class Classifierpublic boolean getDebug()
getDebug in class Classifierpublic void setDebug(boolean newDebug)
setDebug in class ClassifiernewDebug - Value to assign to Debug.public java.lang.String seedTipText()
public void setSeed(int seed)
setSeed in interface Randomizableseed - the seedpublic int getSeed()
getSeed in interface Randomizablepublic java.util.Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class Classifierpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Classifier
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
setOptions in interface OptionHandlersetOptions in class Classifieroptions - the list of options as an array of strings
java.lang.Exception - if an option is not supported
public void buildClassifier(Instances data)
throws java.lang.Exception
buildClassifier in class Classifierdata - set of instances serving as training data
java.lang.Exception - if the classifier has not been
generated successfully
public double[] distributionForInstance(Instance instance)
throws java.lang.Exception
distributionForInstance in class Classifierinstance - the instance to be classified
java.lang.Exception - if distribution could not be
computed successfullypublic java.lang.String toGraph()
public int toGraph(java.lang.StringBuffer text,
int num)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String toString()
protected java.lang.String leafString()
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String toString(int level)
protected void buildTree(int[][] sortedIndices,
double[][] weights,
Instances data,
double[] classProbs,
Instances header,
double minNum,
boolean debug,
int[] attIndicesWindow,
java.util.Random random)
throws java.lang.Exception
java.lang.Exceptionpublic int numNodes()
protected void splitData(int[][][] subsetIndices,
double[][][] subsetWeights,
int att,
double splitPoint,
int[][] sortedIndices,
double[][] weights,
double[][] dist,
Instances data)
throws java.lang.Exception
java.lang.Exception
protected double distribution(double[][] props,
double[][][] dists,
int att,
int[] sortedIndices,
double[] weights,
Instances data)
throws java.lang.Exception
java.lang.Exceptionprotected double priorVal(double[][] dist)
protected double gain(double[][] dist,
double priorVal)
public static void main(java.lang.String[] argv)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||