org.apache.mahout.classifier.df.node
Class Node
java.lang.Object
org.apache.mahout.classifier.df.node.Node
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
- Direct Known Subclasses:
- CategoricalNode, Leaf, NumericalNode
public abstract class Node
- extends Object
- implements org.apache.hadoop.io.Writable
Represents an abstract node of a decision tree
Nested Class Summary |
protected static class |
Node.Type
|
Constructor Summary |
Node()
|
Methods inherited from interface org.apache.hadoop.io.Writable |
readFields |
Node
public Node()
classify
public abstract double classify(Instance instance)
- predicts the label for the instance
- Returns:
- -1 if the label cannot be predicted
nbNodes
public abstract long nbNodes()
- Returns:
- the total number of nodes of the tree
maxDepth
public abstract long maxDepth()
- Returns:
- the maximum depth of the tree
getType
protected abstract Node.Type getType()
read
public static Node read(DataInput in)
throws IOException
- Throws:
IOException
toString
public final String toString()
- Overrides:
toString
in class Object
getString
protected abstract String getString()
write
public final void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
writeNode
protected abstract void writeNode(DataOutput out)
throws IOException
- Throws:
IOException
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.