org.apache.mahout.classifier.df.node
Class Node

java.lang.Object
  extended by 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()
           
 
Method Summary
abstract  double classify(Instance instance)
          predicts the label for the instance
protected abstract  String getString()
           
protected abstract  Node.Type getType()
           
abstract  long maxDepth()
           
abstract  long nbNodes()
           
static Node read(DataInput in)
           
 String toString()
           
 void write(DataOutput out)
           
protected abstract  void writeNode(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
 

Constructor Detail

Node

public Node()
Method Detail

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.