Package weka.classifiers.trees

# Class M5P

java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.trees.m5.M5Base
weka.classifiers.trees.M5P

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Classifier`, `AdditionalMeasureProducer`, `BatchPredictor`, `CapabilitiesHandler`, `CapabilitiesIgnorer`, `CommandlineRunnable`, `Drawable`, `OptionHandler`, `RevisionHandler`, `TechnicalInformationHandler`

public class M5P extends M5Base implements Drawable
M5Base. Implements base routines for generating M5 Model trees and rules
The original algorithm M5 was invented by R. Quinlan and Yong Wang made improvements.
For more information see:
Ross J. Quinlan: Learning with Continuous Classes. In: 5th Australian Joint Conference on Artificial Intelligence, Singapore, 343-348, 1992.
Y. Wang, I. H. Witten: Induction of model trees for predicting continuous classes. In: Poster papers of the 9th European Conference on Machine Learning, 1997.

BibTeX:

     @inproceedings{Quinlan1992,
        address = {Singapore},
        author = {Ross J. Quinlan},
        booktitle = {5th Australian Joint Conference on Artificial Intelligence},
        pages = {343-348},
        publisher = {World Scientific},
        title = {Learning with Continuous Classes},
        year = {1992}
     }

     @inproceedings{Wang1997,
        author = {Y. Wang and I. H. Witten},
        booktitle = {Poster papers of the 9th European Conference on Machine Learning},
        publisher = {Springer},
        title = {Induction of model trees for predicting continuous classes},
        year = {1997}
     }

Valid options are:

     -N
      Use unpruned tree/rules

     -U
      Use unsmoothed predictions

     -R
      Build regression tree/rule rather than a model tree/rule

     -M <minimum number of instances>
      Set minimum number of instances per leaf
      (default 4)

     -L
      Save instances at the nodes in
      the tree (for visualization purposes)

Version:
  $Revision: 14534 $
Author:
  Mark Hall
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class weka.classifiers.AbstractClassifier

  `BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT`

  ### Fields inherited from interface weka.core.Drawable

  `BayesNet, Newick, NOT_DRAWABLE, TREE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `M5P()`
  Creates a new `M5P` instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String[]`
  `getOptions()`
  Gets the current settings of the classifier.
  `String`
  `getRevision()`
  Returns the revision string.
  `boolean`
  `getSaveInstances()`
  Get whether instance data is being save.
  `String`
  `globalInfo()`
  returns information about the classifier
  `String`
  `graph()`
  Return a dot style String describing the tree.
  `int`
  `graphType()`
  Returns the type of graph this classifier represents.
  `Enumeration<Option>`
  `listOptions()`
  Returns an enumeration describing the available options
  `static void`
  `main(String[] args)`
  Main method by which this class can be tested
  `String`
  `saveInstancesTipText()`
  Returns the tip text for this property
  `void`
  `setOptions(String[] options)`
  Parses a given list of options.
  `void`
  `setSaveInstances(boolean save)`
  Set whether to save instance data at each node in the tree for visualization purposes

  ### Methods inherited from class weka.classifiers.trees.m5.M5Base

  `buildClassifier, buildRegressionTreeTipText, classifyInstance, enumerateMeasures, generateRulesTipText, getBuildRegressionTree, getCapabilities, getM5RootNode, getMeasure, getMinNumInstances, getTechnicalInformation, getUnpruned, getUseUnsmoothed, measureNumRules, minNumInstancesTipText, setBuildRegressionTree, setMinNumInstances, setUnpruned, setUseUnsmoothed, toString, unprunedTipText, useUnsmoothedTipText`

  ### Methods inherited from class weka.classifiers.AbstractClassifier

  `batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### M5P

    public M5P()
    Creates a new `M5P` instance.

- ## Method Details

  - ### globalInfo

    public String globalInfo()
    returns information about the classifier
    Returns:
      a description suitable for displaying in the explorer/experimenter gui

  - ### graphType

    public int graphType()
    Returns the type of graph this classifier represents.
    Specified by:
      `graphType` in interface `Drawable`
    Returns:
      Drawable.TREE

  - ### graph

    public String graph() throws Exception
    Return a dot style String describing the tree.
    Specified by:
      `graph` in interface `Drawable`
    Returns:
      a `String` value
    Throws:
      `Exception` - if an error occurs

  - ### saveInstancesTipText

    public String saveInstancesTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setSaveInstances

    public void setSaveInstances(boolean save)
    Set whether to save instance data at each node in the tree for visualization purposes
    Parameters:
      `save` - a `boolean` value

  - ### getSaveInstances

    public boolean getSaveInstances()
    Get whether instance data is being save.
    Returns:
      a `boolean` value

  - ### listOptions

    public Enumeration<Option> listOptions()
    Returns an enumeration describing the available options
    Specified by:
      `listOptions` in interface `OptionHandler`
    Overrides:
      `listOptions` in class `M5Base`
    Returns:
      an enumeration of all the available options

  - ### setOptions

    public void setOptions(String[] options) throws Exception
    Parses a given list of options.

    Valid options are:

         -N
          Use unpruned tree/rules

         -U
          Use unsmoothed predictions

         -R
          Build regression tree/rule rather than a model tree/rule

         -M <minimum number of instances>
          Set minimum number of instances per leaf
          (default 4)

         -L
          Save instances at the nodes in
          the tree (for visualization purposes)

    Specified by:
      `setOptions` in interface `OptionHandler`
    Overrides:
      `setOptions` in class `M5Base`
    Parameters:
      `options` - the list of options as an array of strings
    Throws:
      `Exception` - if an option is not supported

  - ### getOptions

    public String[] getOptions()
    Gets the current settings of the classifier.
    Specified by:
      `getOptions` in interface `OptionHandler`
    Overrides:
      `getOptions` in class `M5Base`
    Returns:
      an array of strings suitable for passing to setOptions

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Overrides:
      `getRevision` in class `AbstractClassifier`
    Returns:
      the revision

  - ### main

    public static void main(String[] args)
    Main method by which this class can be tested
    Parameters:
      `args` - an array of options