org.apache.mahout.df.node
Class Leaf
java.lang.Object
org.apache.mahout.df.node.Node
org.apache.mahout.df.node.Leaf
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
- Direct Known Subclasses:
- MockLeaf
public class Leaf
- extends Node
Represents a Leaf node
Nested classes/interfaces inherited from class org.apache.mahout.df.node.Node |
Node.Type |
Constructor Summary |
protected |
Leaf()
|
|
Leaf(int label)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Leaf
protected Leaf()
Leaf
public Leaf(int label)
classify
public int 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(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
getString
protected java.lang.String getString()
- Specified by:
getString
in class Node
readFields
public void readFields(java.io.DataInput in)
throws java.io.IOException
- Throws:
java.io.IOException
writeNode
protected void writeNode(java.io.DataOutput out)
throws java.io.IOException
- Specified by:
writeNode
in class Node
- Throws:
java.io.IOException
Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.