public class DirectedGraph extends Object
Modifier and Type | Field and Description |
---|---|
protected FeatureDefinition |
featDef |
protected org.apache.log4j.Logger |
logger |
protected Properties |
properties |
protected Node |
rootNode |
Constructor and Description |
---|
DirectedGraph()
Build a new empty directed graph
|
DirectedGraph(FeatureDefinition featDef)
Build a new empty graph with the given feature definition.
|
DirectedGraph(Node rootNode,
FeatureDefinition featDef)
Build a new graph with the given node as the root node
|
DirectedGraph(Node rootNode,
FeatureDefinition featDef,
Properties properties)
Build a new graph with the given node as the root node
|
Modifier and Type | Method and Description |
---|---|
Iterator<DecisionNode> |
getDecisionNodeIterator()
Return an iterator which returns all decision nodes in the tree exactly once.
|
Iterable<DecisionNode> |
getDecisionNodes()
A representation of the corresponding node iterator that can be used in extended for() statements.
|
Iterator<DirectedGraphNode> |
getDirectedGraphNodeIterator()
Return an iterator which returns all directed graph nodes in the tree exactly once.
|
Iterable<DirectedGraphNode> |
getDirectedGraphNodes()
A representation of the corresponding node iterator that can be used in extended for() statements.
|
FeatureDefinition |
getFeatureDefinition() |
Iterator<LeafNode> |
getLeafNodeIterator()
Return an iterator which returns all leaf nodes in the tree exactly once.
|
Iterable<LeafNode> |
getLeafNodes()
A representation of the corresponding node iterator that can be used in extended for() statements.
|
Iterator<Node> |
getNodeIterator()
Return an iterator which returns all nodes in the tree exactly once.
|
Iterable<Node> |
getNodes()
A representation of the corresponding node iterator that can be used in extended for() statements.
|
int |
getNumNodes()
Get the number of nodes in this CART
|
Properties |
getProperties()
Get the properties object associated with this tree, or null if there is no such object.
|
Node |
getRootNode()
Get the root node of this CART
|
Object |
interpret(FeatureVector fv)
Walk down the graph as far as possible according to the features in fv, and return the data in the leaf node found there.
|
protected Object |
interpret(Node n,
FeatureVector fv)
Follow the directed graph down to the most specific leaf with data, starting from node n.
|
Object |
interpret(Target t) |
void |
setRootNode(Node rNode)
Set the root node of this CART
|
String |
toString() |
protected org.apache.log4j.Logger logger
protected Node rootNode
protected FeatureDefinition featDef
protected Properties properties
public DirectedGraph()
public DirectedGraph(FeatureDefinition featDef)
featDef
- the feature definition used for interpreting the meaning of decision node criteria.public DirectedGraph(Node rootNode, FeatureDefinition featDef)
rootNode
- the root node of the graphfeatDef
- the feature definition used for interpreting the meaning of decision node criteria.public DirectedGraph(Node rootNode, FeatureDefinition featDef, Properties properties)
rootNode
- the root node of the graphfeatDef
- the feature definition used for interpreting the meaning of decision node criteria.properties
- a generic properties object, which can be used to encode information about the tree and the way the data in it
should be represented.public Object interpret(FeatureVector fv)
fv
- a feature vector which must be consistent with the graph's feature definition. (@see #getFeatureDefinition()).protected Object interpret(Node n, FeatureVector fv)
n
- nfv
- fvpublic Iterator<Node> getNodeIterator()
public Iterator<LeafNode> getLeafNodeIterator()
public Iterator<DecisionNode> getDecisionNodeIterator()
public Iterator<DirectedGraphNode> getDirectedGraphNodeIterator()
public Iterable<Node> getNodes()
public Iterable<LeafNode> getLeafNodes()
public Iterable<DecisionNode> getDecisionNodes()
public Iterable<DirectedGraphNode> getDirectedGraphNodes()
public Properties getProperties()
public Node getRootNode()
public void setRootNode(Node rNode)
rNode
- root nodepublic FeatureDefinition getFeatureDefinition()
public int getNumNodes()
Copyright © 2000–2016 DFKI GmbH. All rights reserved.