public class DecisionNode extends LeafNode
Constructor and Description |
---|
DecisionNode(int[] count)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int[] |
count()
Returns the number of node samples in each class.
|
double |
deviance()
Returns the deviance of node.
|
static double |
deviance(int[] count,
double[] prob)
Returns the deviance of node.
|
java.lang.String |
dot(smile.data.type.StructType schema,
smile.data.type.StructField response,
int id)
Returns a dot representation for visualization.
|
boolean |
equals(java.lang.Object o) |
double |
impurity(SplitRule rule)
Returns the impurity of node.
|
static double |
impurity(SplitRule rule,
int size,
int[] count)
Returns the impurity of samples.
|
int |
output()
Returns the predicted value.
|
double[] |
posteriori(double[] prob)
Returns the class probability.
|
static double[] |
posteriori(int[] count,
double[] prob)
Returns the class probability.
|
int[] |
toString(smile.data.type.StructType schema,
smile.data.type.StructField response,
InternalNode parent,
int depth,
java.math.BigInteger id,
java.util.List<java.lang.String> lines)
Adds the string representation (R's rpart format) to a collection.
|
public DecisionNode(int[] count)
count
- the number of node samples in each class.public int output()
public int[] count()
public double deviance()
Node
public java.lang.String dot(smile.data.type.StructType schema, smile.data.type.StructField response, int id)
Node
schema
- the schema of dataresponse
- the schema of response variableid
- node idpublic int[] toString(smile.data.type.StructType schema, smile.data.type.StructField response, InternalNode parent, int depth, java.math.BigInteger id, java.util.List<java.lang.String> lines)
Node
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.public double impurity(SplitRule rule)
public static double impurity(SplitRule rule, int size, int[] count)
size
- the number of samples.count
- the number of samples in each class.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public double[] posteriori(double[] prob)
public static double[] posteriori(int[] count, double[] prob)
public static double deviance(int[] count, double[] prob)