gov.sandia.cognition.learning.algorithm.tree
Class RegressionTreeNode<InputType,InteriorType>

java.lang.Object
  extended by gov.sandia.cognition.learning.algorithm.tree.AbstractDecisionTreeNode<InputType,Double,InteriorType>
      extended by gov.sandia.cognition.learning.algorithm.tree.RegressionTreeNode<InputType,InteriorType>
Type Parameters:
InputType - The input type for the tree.
InteriorType - The type that is the output of the decision made at this tree node.
All Implemented Interfaces:
DecisionTreeNode<InputType,Double>, CloneableSerializable, Serializable, Cloneable

public class RegressionTreeNode<InputType,InteriorType>
extends AbstractDecisionTreeNode<InputType,Double,InteriorType>

The RegressionTreeNode implements a DecisionTreeNode for a tree that does regression.

Since:
2.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
static double DEFAULT_VALUE
          The default value for the node is 0.0.
protected  Evaluator<? super InputType,Double> scalarFunction
          The function to apply for leaf nodes.
protected  double value
          The value stored at the tree node.
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.tree.AbstractDecisionTreeNode
childMap, decider, incomingValue, parent
 
Constructor Summary
RegressionTreeNode()
          Creates a new instance of RegressionTreeNode.
RegressionTreeNode(DecisionTreeNode<InputType,Double> parent, Categorizer<? super InputType,? extends InteriorType> decider, double value)
          Creates a new instance of RegressionTreeNode.
RegressionTreeNode(DecisionTreeNode<InputType,Double> parent, Categorizer<? super InputType,? extends InteriorType> decider, Evaluator<? super InputType,Double> scalarFunction, double value, Object incomingValue)
          Creates a new instance of RegressionTreeNode.
RegressionTreeNode(DecisionTreeNode<InputType,Double> parent, double value)
          Creates a new instance of RegressionTreeNode.
RegressionTreeNode(DecisionTreeNode<InputType,Double> parent, Evaluator<? super InputType,Double> scalarFunction, double value)
          Creates a new instance of RegressionTreeNode.
RegressionTreeNode(DecisionTreeNode<InputType,Double> parent, Evaluator<? super InputType,Double> scalarFunction, double value, Object incomingValue)
          Creates a new instance of RegressionTreeNode.
 
Method Summary
 RegressionTreeNode<InputType,InteriorType> clone()
          Creates a new clone (shallow copy) of this object.
 Double getOutput(InputType input)
          Gets the local output of this node for the given input.
 Evaluator<? super InputType,Double> getScalarFunction()
          Gets the scalar function applied to the input when the node is a leaf node.
 double getValue()
          Gets the value stored at the node, which is usually the mean value.
 void setScalarFunction(Evaluator<? super InputType,Double> scalarFunction)
          Sets the scalar function applied to the input when the node is a leaf node.
 void setValue(double value)
          Sets the value stored at the node, which is usually the mean value.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.tree.AbstractDecisionTreeNode
addChild, chooseChild, getChildMap, getChildren, getDecider, getDepth, getIncomingValue, getParent, getTreeSize, isLeaf, setChildMap, setDecider, setIncomingValue, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VALUE

public static final double DEFAULT_VALUE
The default value for the node is 0.0.

See Also:
Constant Field Values

scalarFunction

protected Evaluator<? super InputType,Double> scalarFunction
The function to apply for leaf nodes.


value

protected double value
The value stored at the tree node. It is used as a backup value if no scalar function exists for the node but the output is requested.

Constructor Detail

RegressionTreeNode

public RegressionTreeNode()
Creates a new instance of RegressionTreeNode.


RegressionTreeNode

public RegressionTreeNode(DecisionTreeNode<InputType,Double> parent,
                          double value)
Creates a new instance of RegressionTreeNode.

Parameters:
parent - The parent node of this node. Null if this is a root.
value - The value stored at the node.

RegressionTreeNode

public RegressionTreeNode(DecisionTreeNode<InputType,Double> parent,
                          Categorizer<? super InputType,? extends InteriorType> decider,
                          double value)
Creates a new instance of RegressionTreeNode.

Parameters:
parent - The parent node of this node. Null if this is a root.
decider - The decision function for interior nodes.
value - The value stored at the node.

RegressionTreeNode

public RegressionTreeNode(DecisionTreeNode<InputType,Double> parent,
                          Evaluator<? super InputType,Double> scalarFunction,
                          double value)
Creates a new instance of RegressionTreeNode.

Parameters:
parent - The parent node of this node. Null if this is a root.
scalarFunction - The scalar function to apply at leaf nodes.
value - The value stored at the node.

RegressionTreeNode

public RegressionTreeNode(DecisionTreeNode<InputType,Double> parent,
                          Evaluator<? super InputType,Double> scalarFunction,
                          double value,
                          Object incomingValue)
Creates a new instance of RegressionTreeNode.

Parameters:
parent - The parent node of this node. Null if this is a root.
scalarFunction - The scalar function to apply at leaf nodes.
value - The value stored at the node.
incomingValue - The incoming value.

RegressionTreeNode

public RegressionTreeNode(DecisionTreeNode<InputType,Double> parent,
                          Categorizer<? super InputType,? extends InteriorType> decider,
                          Evaluator<? super InputType,Double> scalarFunction,
                          double value,
                          Object incomingValue)
Creates a new instance of RegressionTreeNode.

Parameters:
parent - The parent node of this node. Null if this is a root.
decider - The decision function for interior nodes.
scalarFunction - The scalar function to apply at leaf nodes.
value - The value stored at the node.
incomingValue - The incoming value.
Method Detail

clone

public RegressionTreeNode<InputType,InteriorType> clone()
Description copied from interface: CloneableSerializable
Creates a new clone (shallow copy) of this object.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractDecisionTreeNode<InputType,Double,InteriorType>
Returns:
A new clone (shallow copy) of this object.

getOutput

public Double getOutput(InputType input)
Description copied from interface: DecisionTreeNode
Gets the local output of this node for the given input. This is done to determine the output value for a leaf node or the output value in the case that there is no corresponding child node for an input.

Parameters:
input - The input.
Returns:
The local output value for the given input.

getScalarFunction

public Evaluator<? super InputType,Double> getScalarFunction()
Gets the scalar function applied to the input when the node is a leaf node.

Returns:
The scalar function applied to the input for leaves.

setScalarFunction

public void setScalarFunction(Evaluator<? super InputType,Double> scalarFunction)
Sets the scalar function applied to the input when the node is a leaf node.

Parameters:
scalarFunction - The scalar function applied to the input for leaves.

getValue

public double getValue()
Gets the value stored at the node, which is usually the mean value.

Returns:
The value stored at the node.

setValue

public void setValue(double value)
Sets the value stored at the node, which is usually the mean value.

Parameters:
value - The value stored at the node.