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

java.lang.Object
  extended by org.apache.mahout.classifier.df.node.Node
      extended by org.apache.mahout.classifier.df.node.NumericalNode
All Implemented Interfaces:
org.apache.hadoop.io.Writable

public class NumericalNode
extends Node

Represents a node that splits using a numerical attribute


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.mahout.classifier.df.node.Node
Node.Type
 
Constructor Summary
NumericalNode()
           
NumericalNode(int attr, double split, Node loChild, Node hiChild)
           
 
Method Summary
 double classify(Instance instance)
          predicts the label for the instance
 boolean equals(Object obj)
           
protected  String getString()
           
protected  Node.Type getType()
           
 int hashCode()
           
 long maxDepth()
           
 long nbNodes()
           
 void readFields(DataInput in)
           
protected  void writeNode(DataOutput out)
           
 
Methods inherited from class org.apache.mahout.classifier.df.node.Node
read, toString, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumericalNode

public NumericalNode()

NumericalNode

public NumericalNode(int attr,
                     double split,
                     Node loChild,
                     Node hiChild)
Method Detail

classify

public double classify(Instance instance)
Description copied from class: Node
predicts the label for the instance

Specified by:
classify in class Node
Returns:
-1 if the label cannot be predicted

maxDepth

public long maxDepth()
Specified by:
maxDepth in class Node
Returns:
the maximum depth of the tree

nbNodes

public long nbNodes()
Specified by:
nbNodes in class Node
Returns:
the total number of nodes of the tree

getType

protected Node.Type getType()
Specified by:
getType in class Node

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getString

protected String getString()
Specified by:
getString in class Node

readFields

public void readFields(DataInput in)
                throws IOException
Throws:
IOException

writeNode

protected void writeNode(DataOutput out)
                  throws IOException
Specified by:
writeNode in class Node
Throws:
IOException


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.