All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.trees.m5.M5Base

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.trees.m5.M5Base

public abstract class M5Base
extends Classifier
implements OptionHandler, AdditionalMeasureProducer
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

Version:
$Revision: 1.7 $

Constructor Index

 o M5Base()
Constructor

Method Index

 o buildClassifier(Instances)
Generates the classifier.
 o classifyInstance(Instance)
Calculates a prediction for an instance using a set of rules or an M5 model tree
 o enumerateMeasures()
Returns an enumeration of the additional measure names
 o getBuildRegressionTree()
Get the value of regressionTree.
 o getMeasure(String)
Returns the value of the named measure
 o getMinNumInstances()
Get the minimum number of instances to allow at a leaf node
 o getOptions()
Gets the current settings of the classifier.
 o getUnpruned()
Get whether unpruned tree/rules are being generated
 o getUseUnsmoothed()
Get whether or not smoothing is being used
 o listOptions()
Returns an enumeration describing the available options
 o measureNumRules()
return the number of rules
 o setBuildRegressionTree(boolean)
Set the value of regressionTree.
 o setMinNumInstances(double)
Set the minumum number of instances to allow at a leaf node
 o setOptions(String[])
Parses a given list of options.
 o setUnpruned(boolean)
Use unpruned tree/rules
 o setUseUnsmoothed(boolean)
Use unsmoothed predictions
 o toString()
Returns a description of the classifier

Constructor Detail

 o M5Base
public M5Base()
          Constructor

Method Detail

 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
Returns:
an enumeration of all the available options
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options.

Valid options are:

-U
Use unsmoothed predictions.

-R
Build a regression tree rather than a model tree.

Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o getOptions
public java.lang.String[] getOptions()
          Gets the current settings of the classifier.
Returns:
an array of strings suitable for passing to setOptions
 o setUnpruned
public void setUnpruned(boolean unpruned)
          Use unpruned tree/rules
Parameters:
unpruned - true if unpruned tree/rules are to be generated
 o getUnpruned
public boolean getUnpruned()
          Get whether unpruned tree/rules are being generated
Returns:
true if unpruned tree/rules are to be generated
 o setUseUnsmoothed
public void setUseUnsmoothed(boolean s)
          Use unsmoothed predictions
Parameters:
s - true if unsmoothed predictions are to be used
 o getUseUnsmoothed
public boolean getUseUnsmoothed()
          Get whether or not smoothing is being used
Returns:
true if unsmoothed predictions are to be used
 o getBuildRegressionTree
public boolean getBuildRegressionTree()
          Get the value of regressionTree.
Returns:
Value of regressionTree.
 o setBuildRegressionTree
public void setBuildRegressionTree(boolean newregressionTree)
          Set the value of regressionTree.
Parameters:
newregressionTree - Value to assign to regressionTree.
 o setMinNumInstances
public void setMinNumInstances(double minNum)
          Set the minumum number of instances to allow at a leaf node
Parameters:
minNum - the minimum number of instances
 o getMinNumInstances
public double getMinNumInstances()
          Get the minimum number of instances to allow at a leaf node
Returns:
a double value
 o buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
          Generates the classifier.
Parameters:
data - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully
Overrides:
buildClassifier in class Classifier
 o classifyInstance
public double classifyInstance(Instance inst) throws java.lang.Exception
          Calculates a prediction for an instance using a set of rules or an M5 model tree
Parameters:
inst - the instance whos class value is to be predicted
Returns:
the prediction
Throws:
if - a prediction can't be made.
Overrides:
classifyInstance in class Classifier
 o toString
public java.lang.String toString()
          Returns a description of the classifier
Returns:
a description of the classifier as a String
Overrides:
toString in class java.lang.Object
 o enumerateMeasures
public java.util.Enumeration enumerateMeasures()
          Returns an enumeration of the additional measure names
Returns:
an enumeration of the measure names
 o getMeasure
public double getMeasure(java.lang.String additionalMeasureName)
          Returns the value of the named measure
Parameters:
measureName - the name of the measure to query for its value
Returns:
the value of the named measure
Throws:
java.lang.Exception - if the named measure is not supported
 o measureNumRules
public double measureNumRules()
          return the number of rules
Returns:
the number of rules (same as # linear models & # leaves in the tree)

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home