Class RegressionNode
java.lang.Object
smile.base.cart.LeafNode
smile.base.cart.RegressionNode
- All Implemented Interfaces:
Serializable, Node
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionRegressionNode(int size, double output, double mean, double rss) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondoubledeviance()Returns the deviance of node.dot(StructType schema, StructField response, int id) Returns the dot representation of node.booleandoubleimpurity()Returns the residual sum of squares.doublemean()Returns the mean of response variable.doubleoutput()Returns the predicted value.int[]toString(StructType schema, StructField response, InternalNode parent, int depth, BigInteger id, List<String> lines) Adds the string representation (R's rpart format) to a collection.
-
Constructor Details
-
RegressionNode
public RegressionNode(int size, double output, double mean, double rss) Constructor.- Parameters:
size- the number of samples in the nodeoutput- the predicted value for this node.mean- the mean of response variable.rss- the residual sum of squares.
-
-
Method Details
-
output
public double output()Returns the predicted value.- Returns:
- the predicted value.
-
mean
public double mean()Returns the mean of response variable.- Returns:
- the mean of response variable.
-
impurity
public double impurity()Returns the residual sum of squares.- Returns:
- the residual sum of squares.
-
deviance
public double deviance()Description copied from interface:NodeReturns the deviance of node.- Returns:
- the deviance of node.
-
dot
Description copied from interface:NodeReturns the dot representation of node.- Parameters:
schema- the schema of dataresponse- the schema of response variableid- node id- Returns:
- the dot representation of node.
-
toString
public int[] toString(StructType schema, StructField response, InternalNode parent, int depth, BigInteger id, List<String> lines) Description copied from interface:NodeAdds the string representation (R's rpart format) to a collection.- Parameters:
schema- the schema of dataresponse- the schema of response variableparent- the parent nodedepth- the depth of node in the tree. The root node is at depth 0.id- node idlines- the collection of node's string representation.- Returns:
- the sample count of each class for decision tree; single element array [node size] for regression tree.
-
equals
-