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

Class weka.classifiers.m5.M5Prime

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.m5.M5Prime

public final class M5Prime
extends Classifier
implements OptionHandler, AdditionalMeasureProducer
Class for contructing and evaluating model trees; M5' algorithm.

Reference: Wang, Y. and Witten, I.H. (1997). Induction of model trees for predicting continuous classes. Proceedings of the poster papers of the European Conference on Machine Learning. University of Economics, Faculty of Informatics and Statistics, Prague.

Valid options are:

-O
Type of model to be used. (l: linear regression, r: regression tree, m: model tree) (default: m)

-U
Use unsmoothed tree.

-F factor
Set pruning factor (default: 2).

-V <0|1|2>
Verbosity (default: 0).

Version:
$Revision: 1.15.2.1 $
Author:
Yong Wang (yongwang@cs.waikato.ac.nz)

Variable Index

 o MODEL_LINEAR_REGRESSION
 
 o MODEL_MODEL_TREE
 
 o MODEL_REGRESSION_TREE
 
 o TAGS_MODEL_TYPES
 

Constructor Index

 o M5Prime()
 

Method Index

 o buildClassifier(Instances)
Construct a model tree by training instances
 o classifyInstance(Instance)
Classifies the given test instance.
 o enumerateMeasures()
Returns an enumeration of the additional measure names
 o getMeasure(String)
Returns the value of the named measure
 o getModelType()
Get the value of Model.
 o getOptions()
Gets the current settings of the Classifier.
 o getPruningFactor()
Get the value of PruningFactor.
 o getUseUnsmoothed()
Get the value of UseUnsmoothed.
 o getVerbosity()
Get the value of Verbosity.
 o listOptions()
Returns an enumeration describing the available options.
 o main(String[])
Main method for M5' algorithm
 o measureNumLeaves()
return the number of leaves in the tree
 o measureNumLinearModels()
return the number of linear models
 o measureNumRules()
return the number of rules
 o setModelType(SelectedTag)
Set the value of Model.
 o setOptions(String[])
Parses a given list of options.
 o setPruningFactor(double)
Set the value of PruningFactor.
 o setUseUnsmoothed(boolean)
Set the value of UseUnsmoothed.
 o setVerbosity(int)
Set the value of Verbosity.
 o toString()
Converts the output of the training process into a string

Field Detail

 o MODEL_LINEAR_REGRESSION
public static final int MODEL_LINEAR_REGRESSION
 o MODEL_REGRESSION_TREE
public static final int MODEL_REGRESSION_TREE
 o MODEL_MODEL_TREE
public static final int MODEL_MODEL_TREE
 o TAGS_MODEL_TYPES
public static final Tag[] TAGS_MODEL_TYPES

Constructor Detail

 o M5Prime
public M5Prime()

Method Detail

 o buildClassifier
public final void buildClassifier(Instances inst) throws java.lang.Exception
          Construct a model tree by training instances
Parameters:
inst - training instances
options - information for constructing the model tree, mostly from command line options
Returns:
the root of the model tree
Throws:
java.lang.Exception - if the classifier can't be built
Overrides:
buildClassifier in class Classifier
 o classifyInstance
public double classifyInstance(Instance ins) throws java.lang.Exception
          Classifies the given test instance.
Parameters:
instance - the instance to be classified
Returns:
the predicted class for the instance
Throws:
java.lang.Exception - if the instance can't be classified
Overrides:
classifyInstance in class Classifier
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options. Valid options are:

-O
Type of model to be used. (l: linear regression, r: regression tree, m: model tree) (default: m)

-U
Use unsmoothed tree.

-F factor
Set pruning factor (default: 2).

-V <0|1|2>
Verbosity (default: 0).

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.
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 toString
public final java.lang.String toString()
          Converts the output of the training process into a string
Returns:
the converted string
Overrides:
toString in class java.lang.Object
 o measureNumLinearModels
public double measureNumLinearModels()
          return the number of linear models
Returns:
the number of linear models
 o measureNumLeaves
public double measureNumLeaves()
          return the number of leaves in the tree
Returns:
the number leaves in the tree (same as # linear models & # rules)
 o measureNumRules
public double measureNumRules()
          return the number of rules
Returns:
the number of rules (same as # linear models & # leaves in the tree)
 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.IllegalArgumentException - if the named measure is not supported
 o getUseUnsmoothed
public boolean getUseUnsmoothed()
          Get the value of UseUnsmoothed.
Returns:
Value of UseUnsmoothed.
 o setUseUnsmoothed
public void setUseUnsmoothed(boolean v)
          Set the value of UseUnsmoothed.
Parameters:
v - Value to assign to UseUnsmoothed.
 o getPruningFactor
public double getPruningFactor()
          Get the value of PruningFactor.
Returns:
Value of PruningFactor.
 o setPruningFactor
public void setPruningFactor(double v)
          Set the value of PruningFactor.
Parameters:
v - Value to assign to PruningFactor.
 o getModelType
public SelectedTag getModelType()
          Get the value of Model.
Returns:
Value of Model.
 o setModelType
public void setModelType(SelectedTag newMethod)
          Set the value of Model.
Parameters:
v - Value to assign to Model.
 o getVerbosity
public int getVerbosity()
          Get the value of Verbosity.
Returns:
Value of Verbosity.
 o setVerbosity
public void setVerbosity(int v)
          Set the value of Verbosity.
Parameters:
v - Value to assign to Verbosity.
 o main
public static void main(java.lang.String argv[])
          Main method for M5' algorithm
Parameters:
argv - command line arguments

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