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()
|
Method Summary |
abstract int |
classify(Instance instance)
predicts the label for the instance |
protected abstract java.lang.String |
getString()
|
protected abstract Node.Type |
getType()
|
abstract long |
maxDepth()
returns the maximum depth of the tree |
abstract long |
nbNodes()
returns the total number of nodes of the tree |
static Node |
read(java.io.DataInput in)
|
java.lang.String |
toString()
|
void |
write(java.io.DataOutput out)
|
protected abstract void |
writeNode(java.io.DataOutput out)
|
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
- Parameters:
instance
-
- Returns:
- -1 if the label cannot be predicted
nbNodes
public abstract long nbNodes()
- returns the total number of nodes of the tree
- Returns:
maxDepth
public abstract long maxDepth()
- returns the maximum depth of the tree
- Returns:
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.