|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.trees.Id3
Class implementing an Id3 decision tree classifier. For more information, see
R. Quinlan (1986). Induction of decision trees. Machine Learning. Vol.1, No.1, pp. 81-106.
Field Summary | |
private Attribute |
m_Attribute
Attribute used for splitting. |
private Attribute |
m_ClassAttribute
Class attribute of dataset. |
private double |
m_ClassValue
Class value if node is leaf. |
private double[] |
m_Distribution
Class distribution if node is leaf. |
private Id3[] |
m_Successors
The node's successors. |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
Constructor Summary | |
Id3()
|
Method Summary | |
void |
buildClassifier(Instances data)
Builds Id3 decision tree classifier. |
double |
classifyInstance(Instance instance)
Classifies a given test instance using the decision tree. |
private double |
computeEntropy(Instances data)
Computes the entropy of a dataset. |
private double |
computeInfoGain(Instances data,
Attribute att)
Computes information gain for an attribute. |
double[] |
distributionForInstance(Instance instance)
Computes class distribution for instance using decision tree. |
java.lang.String |
globalInfo()
Returns a string describing classifier |
static void |
main(java.lang.String[] args)
Main method. |
private void |
makeTree(Instances data)
Method building Id3 tree. |
private Instances[] |
splitData(Instances data,
Attribute att)
Splits a dataset according to the values of a nominal attribute. |
java.lang.String |
toString()
Prints the decision tree using the private toString method from below. |
private java.lang.String |
toString(int level)
Outputs a tree at a certain level. |
Methods inherited from class weka.classifiers.Classifier |
debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Id3[] m_Successors
private Attribute m_Attribute
private double m_ClassValue
private double[] m_Distribution
private Attribute m_ClassAttribute
Constructor Detail |
public Id3()
Method Detail |
public java.lang.String globalInfo()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data
java.lang.Exception
- if classifier can't be built successfullyprivate void makeTree(Instances data) throws java.lang.Exception
data
- the training data
java.lang.Exception
- if decision tree can't be built successfullypublic double classifyInstance(Instance instance)
classifyInstance
in class Classifier
instance
- the instance to be classified
public double[] distributionForInstance(Instance instance)
distributionForInstance
in class Classifier
instance
- the instance for which distribution is to be computed
public java.lang.String toString()
private double computeInfoGain(Instances data, Attribute att) throws java.lang.Exception
data
- the data for which info gain is to be computedatt
- the attribute
java.lang.Exception
private double computeEntropy(Instances data) throws java.lang.Exception
data
- the data for which entropy is to be computed
java.lang.Exception
private Instances[] splitData(Instances data, Attribute att)
data
- the data which is to be splitatt
- the attribute to be used for splitting
private java.lang.String toString(int level)
level
- the level at which the tree is to be printedpublic static void main(java.lang.String[] args)
args
- the options for the classifier
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |