org.apache.mahout.df.node
Class Node
java.lang.Object
org.apache.mahout.df.node.Node
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
- Direct Known Subclasses:
- CategoricalNode, Leaf, NumericalNode
public abstract class Node
- extends java.lang.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 class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.io.Writable |
readFields |
Node
public Node()
classify
public abstract int 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(java.io.DataInput in)
throws java.io.IOException
- Throws:
java.io.IOException
toString
public final java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getString
protected abstract java.lang.String getString()
write
public final void write(java.io.DataOutput out)
throws java.io.IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
java.io.IOException
writeNode
protected abstract void writeNode(java.io.DataOutput out)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.