|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.mine.decisiontree2.model.DecisionTreeNode
org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeSplit
public abstract class DecisionTreeNodeSplit
An abstract implementation of an inner node of a decision tree, i.e. one that is not a leaf. It mostly holds information about children.
Constructor Summary | |
---|---|
(package private) |
DecisionTreeNodeSplit()
Empty Constructor visible only within package. |
protected |
DecisionTreeNodeSplit(int nodeId,
DataCell majorityClass,
LinkedHashMap<DataCell,Double> classCounts,
String splitAttribute)
Constructor of base class. |
|
DecisionTreeNodeSplit(Node xmlNode,
DataCellStringMapper mapper)
Constructor of derived class. |
Method Summary | |
---|---|
abstract void |
addCoveredColor(DataCell cell,
DataRow row,
DataTableSpec spec,
double weight)
Add colors for patterns given as a row of values if they fall within a specific node. |
void |
addCoveredColor(DataRow row,
DataTableSpec spec,
double weight)
Add colors for a row of values if they fall within a specific node/branch. |
abstract void |
addCoveredPattern(DataCell cell,
DataRow row,
DataTableSpec spec,
double weight)
Add patterns given as a row of values if they fall within a specific node. |
void |
addCoveredPattern(DataRow row,
DataTableSpec spec,
double weight)
Add patterns given as a row of values if they fall within a specific node. |
void |
addNode(DecisionTreeNode node,
int index)
Add the given node to this node at the given branch index. |
boolean |
addNodeToTreeDepthFirst(DecisionTreeNode node,
int ix)
Add a new node to the tree structure based on a depth-first indexing strategy. |
Enumeration<DecisionTreeNode> |
children()
|
abstract Set<RowKey> |
coveredPattern()
|
boolean |
getAllowsChildren()
|
TreeNode |
getChildAt(int pos)
|
int |
getChildCount()
|
protected DecisionTreeNode |
getChildNodeAt(int pos)
Return DecisionTreeNode at specific branch. |
DecisionTreeNode[] |
getChildren()
Returns the children. |
abstract LinkedHashMap<DataCell,Double> |
getClassCounts(DataCell cell,
DataRow row,
DataTableSpec spec)
Determine class counts for a new pattern given as a row of values. |
LinkedHashMap<DataCell,Double> |
getClassCounts(DataRow row,
DataTableSpec spec)
Determine class counts for a new pattern given as a row of values. |
int |
getCountOfSubtree()
Returns the count of the subtree. |
int |
getIndex(TreeNode node)
Returns the index of node in the receivers children. |
PMMLMissingValueStrategy |
getMVStrategy()
|
protected LinkedHashMap<DataCell,Double> |
getNodeClassWeights()
Combines all class weights from _all_ branches of this node. |
PMMLNoTrueChildStrategy |
getNTCStrategy()
|
String |
getSplitAttr()
Return name of attribute this node splits on. |
boolean |
isLeaf()
|
void |
loadNodeInternalsFromPredParams(ModelContentRO pConf)
Load internal node settings from a model content object. |
abstract void |
loadNodeSplitInternalsFromPredParams(ModelContentRO pConf)
Load internal SplitNode settings from a ModelContent object. |
protected void |
makeRoomForKids(int nrKids)
Reserve space for specific number of kids. |
void |
replaceChild(DecisionTreeNode oldNode,
DecisionTreeNode newNode)
Replace the given child by the new given one. |
void |
saveNodeInternalsToPredParams(ModelContentWO pConf,
boolean saveKeysAndPatterns)
Save internal node settings to a model content object. |
abstract void |
saveNodeSplitInternalsToPredParams(ModelContentWO pConf)
save internal SplitNode settings to a ModelContent object. |
protected void |
setChildNodeIndex(int pos,
int index)
Mark index of child node at a specific branch. |
void |
setMVStrategy(PMMLMissingValueStrategy strategy)
Set the missing value strategy and propagate it to all children that are split nodes. |
void |
setNTCStrategy(PMMLNoTrueChildStrategy ntcStrategy)
Set the no true child strategy and propagate it to all children that are split nodes. |
Methods inherited from class org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode |
---|
addColorToMap, classifyPattern, coveredColors, createNewNode, createNodeFromPredictorParams, getClassCounts, getCustomData, getEntireClassCount, getMajorityClass, getOverallColorCount, getOwnClassCount, getOwnIndex, getParent, getPrefix, getStringSummary, getWinner, loadFromPredictorParams, newColors, resetColorInformation, saveToPredictorParams, setCoveredColors, setCustomData, setParent, setPrefix, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
DecisionTreeNodeSplit()
public DecisionTreeNodeSplit(Node xmlNode, DataCellStringMapper mapper)
xmlNode
- XML node infomapper
- map translating column names to DataCell
s and vice
versaprotected DecisionTreeNodeSplit(int nodeId, DataCell majorityClass, LinkedHashMap<DataCell,Double> classCounts, String splitAttribute)
nodeId
- the id of this nodemajorityClass
- the majority class of the records in this nodeclassCounts
- the class distribution of the data in this nodesplitAttribute
- the attribute name on which to splitMethod Detail |
---|
public String getSplitAttr()
protected void makeRoomForKids(int nrKids)
nrKids
- number of children attached to this nodeprotected void setChildNodeIndex(int pos, int index)
pos
- position of branch at this nodeindex
- index of child nodeprotected DecisionTreeNode getChildNodeAt(int pos)
pos
- position of branch
public void addNode(DecisionTreeNode node, int index)
node
- node to be insertedindex
- of the child array where to insert the given nodepublic boolean addNodeToTreeDepthFirst(DecisionTreeNode node, int ix)
addNodeToTreeDepthFirst
in class DecisionTreeNode
node
- node to be insertedix
- index of this node in depth first traversal order
public LinkedHashMap<DataCell,Double> getClassCounts(DataRow row, DataTableSpec spec) throws Exception
getClassCounts
in class DecisionTreeNode
row
- input patternspec
- the corresponding table spec
Exception
- if something went wrong (unknown attriubte for example)protected LinkedHashMap<DataCell,Double> getNodeClassWeights()
public abstract LinkedHashMap<DataCell,Double> getClassCounts(DataCell cell, DataRow row, DataTableSpec spec) throws Exception
cell
- the call to be used for classification at this noderow
- input patternspec
- the corresponding table spec
Exception
- if something went wrong (unknown attriubte for example)public final void addCoveredPattern(DataRow row, DataTableSpec spec, double weight) throws Exception
addCoveredPattern
in class DecisionTreeNode
row
- input patternspec
- the corresponding table specweight
- the weight of the row (between 0.0 and 1.0)
Exception
- if something went wrong (unknown attribute for example)public abstract void addCoveredPattern(DataCell cell, DataRow row, DataTableSpec spec, double weight) throws Exception
cell
- the cell to be used for classification at this noderow
- input patternspec
- the corresponding table specweight
- the weight of this row (between 0.0 and 1.0)
Exception
- if something went wrong (unknown attribute for example)public final void addCoveredColor(DataRow row, DataTableSpec spec, double weight) throws Exception
addCoveredColor
in class DecisionTreeNode
row
- input patternspec
- the corresponding table specweight
- the weight of the row (between 0.0 and 1.0)
Exception
- if something went wrong (unknown attribute for example)public abstract void addCoveredColor(DataCell cell, DataRow row, DataTableSpec spec, double weight) throws Exception
cell
- the call to be used for classification at this noderow
- input patternspec
- the corresponding table specweight
- the weight of this row (between 0.0 and 1.0)
Exception
- if something went wrong (unknown attribute for example)public abstract Set<RowKey> coveredPattern()
coveredPattern
in class DecisionTreeNode
public final void saveNodeInternalsToPredParams(ModelContentWO pConf, boolean saveKeysAndPatterns)
saveNodeInternalsToPredParams
in class DecisionTreeNode
pConf
- configuration object to attach decision tree tosaveKeysAndPatterns
- whether to save the keys and patternspublic abstract void saveNodeSplitInternalsToPredParams(ModelContentWO pConf)
pConf
- configuration object to save decision tree topublic final void loadNodeInternalsFromPredParams(ModelContentRO pConf) throws InvalidSettingsException
loadNodeInternalsFromPredParams
in class DecisionTreeNode
pConf
- configuration object to load decision tree from
InvalidSettingsException
- if something goes wrongpublic abstract void loadNodeSplitInternalsFromPredParams(ModelContentRO pConf) throws InvalidSettingsException
pConf
- configuration object to load decision tree from.
InvalidSettingsException
- if something goes wrongpublic int getChildCount()
getChildCount
in interface TreeNode
getChildCount
in class DecisionTreeNode
public int getIndex(TreeNode node)
getIndex
in interface TreeNode
getIndex
in class DecisionTreeNode
node
- that supposedly is a child of this one
public TreeNode getChildAt(int pos)
getChildAt
in interface TreeNode
getChildAt
in class DecisionTreeNode
pos
- position of child
public boolean isLeaf()
isLeaf
in interface TreeNode
isLeaf
in class DecisionTreeNode
true
if node is a leafpublic Enumeration<DecisionTreeNode> children()
children
in interface TreeNode
children
in class DecisionTreeNode
public DecisionTreeNode[] getChildren()
public boolean getAllowsChildren()
getAllowsChildren
in interface TreeNode
getAllowsChildren
in class DecisionTreeNode
true
if the receiver allows childrenpublic void replaceChild(DecisionTreeNode oldNode, DecisionTreeNode newNode)
oldNode
- the node to replacenewNode
- the new nodepublic int getCountOfSubtree()
getCountOfSubtree
in class DecisionTreeNode
public PMMLMissingValueStrategy getMVStrategy()
public void setMVStrategy(PMMLMissingValueStrategy strategy)
strategy
- the strategy to setpublic PMMLNoTrueChildStrategy getNTCStrategy()
public void setNTCStrategy(PMMLNoTrueChildStrategy ntcStrategy)
ntcStrategy
- the strategy to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |