Class RandomRegressionForest

  • All Implemented Interfaces:
    Serializable, Cloneable, weka.classifiers.Classifier, weka.core.BatchPredictor, weka.core.CapabilitiesHandler, weka.core.CapabilitiesIgnorer, weka.core.CommandlineRunnable, weka.core.OptionHandler, weka.core.Randomizable, weka.core.RevisionHandler, weka.core.WeightedInstancesHandler

    public class RandomRegressionForest
    extends weka.classifiers.RandomizableClassifier
    implements weka.core.WeightedInstancesHandler
    RandomRegressionForest: subtract mean and pls, then grow completely random trees (leaf: min .. 2min).
    plus local regression models (-S 1 -C), min >> numPLScomps

    Valid options are:

     -N <num>
      Number of trees.
      (default 100)
     -M <num>
      Leaf threshold.
      (default 100)
     -C <num>
      Number of PLS components.
      (default 20)
     -S <num>
      Random number seed.
      (default 1)
     -D
      If set, classifier is run in debug mode and
      may output additional info to the console
    Version:
    $Revision$
    Author:
    Bernhard Pfahringer (bernhard at cs dot waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected weka.core.Instances m_Data
      the original header
      protected double m_Mean
      the mean
      protected int m_Min
      the minimum number of instances in subsets
      protected RandomRegressionForest.Node[] m_Node
      the generated nodes
      protected int m_NumIterations
      The number of iterations.
      protected int m_PLS
      the number of components to use in PLS
      protected weka.filters.supervised.attribute.PLSFilter m_PLSFilter
      the PLS filter used internally
      • Fields inherited from class weka.classifiers.RandomizableClassifier

        m_Seed
      • Fields inherited from class weka.classifiers.AbstractClassifier

        BATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULT
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildClassifier​(weka.core.Instances data)
      builds the classifier
      protected weka.core.Instances centerClass​(weka.core.Instances data)
      Centers the class value in the data.
      double classifyInstance​(weka.core.Instance instance)
      Calculates the class membership probabilities for the given test instance.
      weka.core.Capabilities getCapabilities()
      Returns default capabilities of the classifier.
      int getMin()
      Gets the current leaf threshold.
      int getNumIterations()
      Gets the number of iterations
      String[] getOptions()
      Gets the current settings of the Classifier.
      int getPLS()
      Gets the current number of PLS components to generate.
      String getRevision()  
      String globalInfo()
      Returns a string describing this classifier.
      Enumeration listOptions()
      Returns an enumeration describing the available options.
      static void main​(String[] args)
      Main method for testing this class.
      String minTipText()
      Returns the tip text for this property
      String numIterationsTipText()
      Returns the tip text for this property
      String PLSTipText()
      Returns the tip text for this property
      void setMin​(int value)
      Sets the leaf threshold.
      void setNumIterations​(int value)
      Sets the number of iterations
      void setOptions​(String[] options)
      Parses a given list of options.
      void setPLS​(int value)
      Sets the number of PLS components to generate.
      String toString()
      Returns description of the classifier.
      • Methods inherited from class weka.classifiers.RandomizableClassifier

        getSeed, seedTipText, setSeed
      • 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
    • Field Detail

      • m_NumIterations

        protected int m_NumIterations
        The number of iterations.
      • m_PLS

        protected int m_PLS
        the number of components to use in PLS
      • m_Min

        protected int m_Min
        the minimum number of instances in subsets
      • m_Data

        protected weka.core.Instances m_Data
        the original header
      • m_PLSFilter

        protected weka.filters.supervised.attribute.PLSFilter m_PLSFilter
        the PLS filter used internally
      • m_Mean

        protected double m_Mean
        the mean
    • Constructor Detail

      • RandomRegressionForest

        public RandomRegressionForest()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing this classifier.
        Returns:
        a description of the classifier suitable for displaying in the explorer/experimenter gui
      • listOptions

        public Enumeration listOptions()
        Returns an enumeration describing the available options.
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Overrides:
        listOptions in class weka.classifiers.RandomizableClassifier
        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 <num>
          Number of trees.
          (default 100)
         -M <num>
          Leaf threshold.
          (default 100)
         -C <num>
          Number of PLS components.
          (default 20)
         -S <num>
          Random number seed.
          (default 1)
         -D
          If set, classifier is run in debug mode and
          may output additional info to the console
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.classifiers.RandomizableClassifier
        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 weka.core.OptionHandler
        Overrides:
        getOptions in class weka.classifiers.RandomizableClassifier
        Returns:
        an array of strings suitable for passing to setOptions
      • numIterationsTipText

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

        public void setNumIterations​(int value)
        Sets the number of iterations
        Parameters:
        value - the number of iterations to use
      • getNumIterations

        public int getNumIterations()
        Gets the number of iterations
        Returns:
        the maximum number of iterations
      • minTipText

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

        public void setMin​(int value)
        Sets the leaf threshold.
        Parameters:
        value - the new leaf threshold
      • getMin

        public int getMin()
        Gets the current leaf threshold.
        Returns:
        the current leaf threshold
      • PLSTipText

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

        public void setPLS​(int value)
        Sets the number of PLS components to generate.
        Parameters:
        value - the number of PLS components
      • getPLS

        public int getPLS()
        Gets the current number of PLS components to generate.
        Returns:
        the current number of PLS components
      • centerClass

        protected weka.core.Instances centerClass​(weka.core.Instances data)
        Centers the class value in the data.
        Parameters:
        data - the data to work on
        Returns:
        the modified data
      • getCapabilities

        public weka.core.Capabilities getCapabilities()
        Returns default capabilities of the classifier.
        Specified by:
        getCapabilities in interface weka.core.CapabilitiesHandler
        Specified by:
        getCapabilities in interface weka.classifiers.Classifier
        Overrides:
        getCapabilities in class weka.classifiers.AbstractClassifier
        Returns:
        the capabilities of this classifier
      • buildClassifier

        public void buildClassifier​(weka.core.Instances data)
                             throws Exception
        builds the classifier
        Specified by:
        buildClassifier in interface weka.classifiers.Classifier
        Parameters:
        data - the training data to be used for generating the
        Throws:
        Exception - if the classifier could not be built successfully
      • classifyInstance

        public double classifyInstance​(weka.core.Instance instance)
                                throws Exception
        Calculates the class membership probabilities for the given test instance.
        Specified by:
        classifyInstance in interface weka.classifiers.Classifier
        Overrides:
        classifyInstance in class weka.classifiers.AbstractClassifier
        Parameters:
        instance - the instance to be classified
        Returns:
        preedicted class probability distribution
        Throws:
        Exception - if distribution can't be computed successfully
      • toString

        public String toString()
        Returns description of the classifier.
        Overrides:
        toString in class Object
        Returns:
        description of the classifier as a string
      • main

        public static void main​(String[] args)
        Main method for testing this class.
        Parameters:
        args - the options
      • getRevision

        public String getRevision()
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Overrides:
        getRevision in class weka.classifiers.AbstractClassifier