|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.trees.m5.M5Base
M5Base. Implements base routines for generating M5 Model trees and rules.
Valid options are:
-U
Use unsmoothed predictions.
-R
Build regression tree/rule rather than model tree/rule
Field Summary | |
private int |
m_classIndex
the class index |
private boolean |
m_generateRules
generate a decision list instead of a single tree. |
private Instances |
m_instances
the instances covered by the tree/rules |
protected double |
m_minNumInstances
The minimum number of instances to allow at a leaf node |
private NominalToBinary |
m_nominalToBinary
filter to convert nominal attributes to binary |
private int |
m_numAttributes
the number of attributes |
private int |
m_numInstances
the number of instances in the dataset |
protected boolean |
m_regressionTree
Make a regression tree/rule instead of a model tree/rule |
private ReplaceMissingValues |
m_replaceMissing
filter to fill in missing values |
protected FastVector |
m_ruleSet
the rule set |
protected boolean |
m_saveInstances
Save instances at each node in an M5 tree for visualization purposes. |
private boolean |
m_unsmoothedPredictions
use unsmoothed predictions |
protected boolean |
m_useUnpruned
Do not prune tree/rules |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
Constructor Summary | |
M5Base()
Constructor |
Method Summary | |
void |
buildClassifier(Instances data)
Generates the classifier. |
double |
classifyInstance(Instance inst)
Calculates a prediction for an instance using a set of rules or an M5 model tree |
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names |
boolean |
getBuildRegressionTree()
Get the value of regressionTree. |
protected boolean |
getGenerateRules()
get whether rules are being generated rather than a tree |
RuleNode |
getM5RootNode()
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure |
double |
getMinNumInstances()
Get the minimum number of instances to allow at a leaf node |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
boolean |
getUnpruned()
Get whether unpruned tree/rules are being generated |
boolean |
getUseUnsmoothed()
Get whether or not smoothing is being used |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
double |
measureNumRules()
return the number of rules |
void |
setBuildRegressionTree(boolean newregressionTree)
Set the value of regressionTree. |
protected void |
setGenerateRules(boolean u)
Generate rules (decision list) rather than a tree |
void |
setMinNumInstances(double minNum)
Set the minumum number of instances to allow at a leaf node |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setUnpruned(boolean unpruned)
Use unpruned tree/rules |
void |
setUseUnsmoothed(boolean s)
Use unsmoothed predictions |
java.lang.String |
toString()
Returns a description of the classifier |
Methods inherited from class weka.classifiers.Classifier |
debugTipText, distributionForInstance, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Instances m_instances
private int m_classIndex
private int m_numAttributes
private int m_numInstances
protected FastVector m_ruleSet
private boolean m_generateRules
private boolean m_unsmoothedPredictions
private ReplaceMissingValues m_replaceMissing
private NominalToBinary m_nominalToBinary
protected boolean m_saveInstances
protected boolean m_regressionTree
protected boolean m_useUnpruned
protected double m_minNumInstances
Constructor Detail |
public M5Base()
Method Detail |
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
Valid options are:
-U
Use unsmoothed predictions.
-R
Build a regression tree rather than a model tree.
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 void setUnpruned(boolean unpruned)
unpruned
- true if unpruned tree/rules are to be generatedpublic boolean getUnpruned()
protected void setGenerateRules(boolean u)
u
- true if rules are to be generatedprotected boolean getGenerateRules()
public void setUseUnsmoothed(boolean s)
s
- true if unsmoothed predictions are to be usedpublic boolean getUseUnsmoothed()
public boolean getBuildRegressionTree()
public void setBuildRegressionTree(boolean newregressionTree)
newregressionTree
- Value to assign to regressionTree.public void setMinNumInstances(double minNum)
minNum
- the minimum number of instancespublic double getMinNumInstances()
double
valuepublic 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 classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in class Classifier
inst
- the instance whos class value is to be predicted
if
- a prediction can't be made.
java.lang.Exception
- if an error occurred during the predictionpublic java.lang.String toString()
public java.util.Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its value
java.lang.Exception
- if the named measure is not supportedpublic double measureNumRules()
public RuleNode getM5RootNode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |