weka.classifiers.trees
Class RandomRegressionForest.Node

java.lang.Object
  extended by weka.classifiers.trees.RandomRegressionForest.Node
All Implemented Interfaces:
Serializable
Enclosing class:
RandomRegressionForest

public class RandomRegressionForest.Node
extends Object
implements Serializable

TODO: description of class

Version:
$Revision: 5087 $
Author:
Bernhard Pfahringer (bernhard@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
protected  RandomRegressionForest.Node m_Less
           
protected  weka.classifiers.functions.LinearRegression m_LinearReg
           
protected  RandomRegressionForest.Node m_More
           
protected  int m_SplitIndex
           
protected  double m_SplitValue
           
 
Constructor Summary
RandomRegressionForest.Node(weka.core.Instances data, Random r, int min)
          the constructor
 
Method Summary
 double classifyInstance(weka.core.Instance instance)
          classifies the given instance
 void findRandomSplit(weka.core.Instances data, Random r, int min)
          determines a random split for the data, tries 10 pairs.
 void prefix(int indent, StringBuffer sb)
          generates the tree structure prefix
 boolean subsetSizesOK(weka.core.Instances data, int min)
          tests whether the leaf threshold is OK
 void toString(int indent, StringBuffer sb, List<String> models)
          Generates a string representation of the node.
 void turnIntoLeaf(weka.core.Instances data)
          turns the node into a leaf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_SplitValue

protected double m_SplitValue

m_SplitIndex

protected int m_SplitIndex

m_LinearReg

protected weka.classifiers.functions.LinearRegression m_LinearReg

m_Less

protected RandomRegressionForest.Node m_Less

m_More

protected RandomRegressionForest.Node m_More
Constructor Detail

RandomRegressionForest.Node

public RandomRegressionForest.Node(weka.core.Instances data,
                                   Random r,
                                   int min)
                            throws Exception
the constructor

Parameters:
data - the data to use
r - the random number generator to use
min - the leaf threshold
Throws:
Exception - if something goes wrong
Method Detail

turnIntoLeaf

public void turnIntoLeaf(weka.core.Instances data)
                  throws Exception
turns the node into a leaf

Parameters:
data - the data to use for linear regression
Throws:
Exception - if training of LinearRegression fails

classifyInstance

public double classifyInstance(weka.core.Instance instance)
                        throws Exception
classifies the given instance

Parameters:
instance - the instance to classify
Returns:
the regression value
Throws:
Exception - if the classification fails

findRandomSplit

public void findRandomSplit(weka.core.Instances data,
                            Random r,
                            int min)
determines a random split for the data, tries 10 pairs.

Parameters:
data - the data to use
r - the random number generator for
min - the leaf threshold
See Also:
m_SplitIndex, m_SplitValue

subsetSizesOK

public boolean subsetSizesOK(weka.core.Instances data,
                             int min)
tests whether the leaf threshold is OK

Parameters:
data - the data to use
min - the leaf threshold
Returns:
true if the size is OK

prefix

public void prefix(int indent,
                   StringBuffer sb)
generates the tree structure prefix

Parameters:
indent - the depth
sb - the StringBuffer to add the prefix to

toString

public void toString(int indent,
                     StringBuffer sb,
                     List<String> models)
Generates a string representation of the node.

Parameters:
indent - the depth
sb - the StringBuffer to add the output to
models - the list to add the generated output to


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.