|
||||||||||
| 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()
|
DecisionTreeNode |
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, coveredColors, createNewNode, createNodeFromPredictorParams, getClassCounts, getCustomData, getEntireClassCount, getMajorityClass, getOverallColorCount, getOwnClassCount, getOwnIndex, getParent, getPrefix, getStringSummary, getWinnerAndClasscounts, 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 DataCells and vice
versa
protected 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 split| Method Detail |
|---|
public String getSplitAttr()
protected void makeRoomForKids(int nrKids)
nrKids - number of children attached to this node
protected 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 node
public boolean addNodeToTreeDepthFirst(DecisionTreeNode node,
int ix)
addNodeToTreeDepthFirst in class DecisionTreeNodenode - node to be insertedix - index of this node in depth first traversal order
public LinkedHashMap<DataCell,Double> getClassCounts(DataRow row,
DataTableSpec spec)
getClassCounts in class DecisionTreeNoderow - input patternspec - the corresponding table spec
protected LinkedHashMap<DataCell,Double> getNodeClassWeights()
public abstract LinkedHashMap<DataCell,Double> getClassCounts(DataCell cell,
DataRow row,
DataTableSpec spec)
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 DecisionTreeNoderow - 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 DecisionTreeNoderow - 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 DecisionTreeNodepConf - 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 to
public final void loadNodeInternalsFromPredParams(ModelContentRO pConf)
throws InvalidSettingsException
loadNodeInternalsFromPredParams in class DecisionTreeNodepConf - configuration object to load decision tree from
InvalidSettingsException - if something goes wrong
public 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 TreeNodegetChildCount in class DecisionTreeNodepublic int getIndex(TreeNode node)
getIndex in interface TreeNodegetIndex in class DecisionTreeNodenode - that supposedly is a child of this one
public DecisionTreeNode getChildAt(int pos)
getChildAt in interface TreeNodegetChildAt in class DecisionTreeNodepos - position of child
public boolean isLeaf()
isLeaf in interface TreeNodeisLeaf in class DecisionTreeNodetrue if node is a leafpublic Enumeration<DecisionTreeNode> children()
children in interface TreeNodechildren in class DecisionTreeNodepublic DecisionTreeNode[] getChildren()
public boolean getAllowsChildren()
getAllowsChildren in interface TreeNodegetAllowsChildren in class DecisionTreeNodetrue if the receiver allows children
public void replaceChild(DecisionTreeNode oldNode,
DecisionTreeNode newNode)
oldNode - the node to replacenewNode - the new nodepublic int getCountOfSubtree()
getCountOfSubtree in class DecisionTreeNodepublic 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 | |||||||||