public abstract class DecisionNode extends Node
Modifier and Type | Class and Description |
---|---|
static class |
DecisionNode.BinaryByteDecisionNode
A binary decision Node that compares two byte values.
|
static class |
DecisionNode.BinaryFloatDecisionNode
A binary decision Node that compares two float values.
|
static class |
DecisionNode.BinaryShortDecisionNode
A binary decision Node that compares two short values.
|
static class |
DecisionNode.ByteDecisionNode
An decision Node with an arbitrary number of daughters.
|
static class |
DecisionNode.ShortDecisionNode
An decision Node with an arbitrary number of daughters.
|
static class |
DecisionNode.Type |
Modifier and Type | Field and Description |
---|---|
protected Node[] |
daughters |
protected String |
feature |
protected FeatureDefinition |
featureDefinition |
protected int |
featureIndex |
protected int |
lastDaughter |
protected int |
nData |
protected boolean |
TRACE |
protected int |
uniqueDecisionNodeId |
Constructor and Description |
---|
DecisionNode(int numDaughters,
FeatureDefinition featureDefinition)
Construct a new DecisionNode
|
DecisionNode(int featureIndex,
int numDaughters,
FeatureDefinition featureDefinition)
Construct a new DecisionNode
|
DecisionNode(String feature,
int numDaughters,
FeatureDefinition featureDefinition)
Construct a new DecisionNode
|
Modifier and Type | Method and Description |
---|---|
void |
addDaughter(Node daughter)
Add a daughter to the node
|
void |
countData()
Set the number of candidates correctly, by counting while walking down the tree.
|
protected void |
fillData(Object target,
int pos,
int total)
Write this node's data into the target object at pos, making sure that exactly len data are written.
|
Object |
getAllData()
Get all unit indices from all leaves below this node
|
Node |
getDaughter(int index)
Get the daughter at the specified index
|
abstract DecisionNode.Type |
getDecisionNodeType()
Get the decision node type
|
abstract String |
getDecisionPath(int daughterIndex)
Get the path leading to the daughter with the given index.
|
FeatureDefinition |
getFeatureDefinition() |
int |
getFeatureIndex() |
String |
getFeatureName()
Get the name of the feature
|
abstract Node |
getNextNode(FeatureVector featureVector)
Select a daughter node according to the value in the given target
|
abstract String |
getNodeDefinition()
Gets the String that defines the decision done in the node
|
int |
getNumberOfData()
Count all the data available at and below this node.
|
int |
getNumberOfDaugthers()
Number of daughters of current node.
|
int |
getNumberOfNodes()
Count all the nodes at and below this node.
|
int |
getUniqueDecisionNodeId() |
boolean |
hasMoreDaughters(int index)
Tests, if the given index refers to a daughter
|
boolean |
isDecisionNode() |
void |
replaceDaughter(Node newDaughter,
int index)
Replace daughter at given index with another daughter
|
void |
setUniqueDecisionNodeId(int id) |
String |
toString() |
getDecisionPath, getMother, getNodeIndex, getRootNode, isDirectedGraphNode, isLeafNode, isRoot, setIsRoot, setMother, toString
protected boolean TRACE
protected FeatureDefinition featureDefinition
protected Node[] daughters
protected int featureIndex
protected String feature
protected int lastDaughter
protected int nData
protected int uniqueDecisionNodeId
public DecisionNode(String feature, int numDaughters, FeatureDefinition featureDefinition)
feature
- the featurenumDaughters
- the number of daughtersfeatureDefinition
- feature definitionpublic DecisionNode(int featureIndex, int numDaughters, FeatureDefinition featureDefinition)
featureIndex
- the feature indexnumDaughters
- the number of daughtersfeatureDefinition
- feature definitionpublic DecisionNode(int numDaughters, FeatureDefinition featureDefinition)
numDaughters
- the number of daughtersfeatureDefinition
- feature definitionpublic boolean isDecisionNode()
isDecisionNode
in class Node
public String getFeatureName()
public int getFeatureIndex()
public FeatureDefinition getFeatureDefinition()
public void addDaughter(Node daughter)
daughter
- the new daughterpublic Node getDaughter(int index)
index
- the index of the daughterpublic void replaceDaughter(Node newDaughter, int index)
newDaughter
- the new daughterindex
- the index of the daughter to replacepublic boolean hasMoreDaughters(int index)
index
- the indexpublic Object getAllData()
getAllData
in class Node
protected void fillData(Object target, int pos, int total)
Node
public int getNumberOfNodes()
getNumberOfNodes
in class Node
public int getNumberOfData()
Node
getNumberOfData
in class Node
public int getNumberOfDaugthers()
public void countData()
public abstract String getDecisionPath(int daughterIndex)
daughterIndex
- daughterIndexpublic void setUniqueDecisionNodeId(int id)
public int getUniqueDecisionNodeId()
public abstract String getNodeDefinition()
public abstract DecisionNode.Type getDecisionNodeType()
public abstract Node getNextNode(FeatureVector featureVector)
featureVector
- the feature vectorCopyright © 2000–2016 DFKI GmbH. All rights reserved.