|
||||||||||
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.DecisionTreeNodeLeaf
public class DecisionTreeNodeLeaf
The Leaf of a decision tree. It stores class information and also some information about the patterns this leaf "coveres".
Constructor Summary | |
---|---|
DecisionTreeNodeLeaf()
Empty Constructor visible only within package. |
|
DecisionTreeNodeLeaf(int nodeId,
DataCell majorityClass,
LinkedHashMap<DataCell,Double> classCounts)
Constructor of base class. |
|
DecisionTreeNodeLeaf(Node xmlNode,
DataCellStringMapper mapper)
Constructor of derived class. |
Method Summary | |
---|---|
void |
addCoveredColor(DataRow row,
DataTableSpec spec,
double weight)
Add colors for a pattern given as a row of values. |
void |
addCoveredPattern(DataRow row,
DataTableSpec spec,
double weight)
Add patterns given as a row of values. |
boolean |
addNodeToTreeDepthFirst(DecisionTreeNode node,
int ix)
Add a new node to the tree structure based on a depth-first indexing strategy. |
Enumeration<DecisionTreeNode> |
children()
|
Set<RowKey> |
coveredPattern()
|
boolean |
getAllowsChildren()
|
TreeNode |
getChildAt(int pos)
|
int |
getChildCount()
|
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. |
String |
getStringSummary()
|
boolean |
isLeaf()
|
boolean |
isPureEnough()
Get the marker field for the purity. |
void |
loadNodeInternalsFromPredParams(ModelContentRO pConf)
Load internal node settings from a model content object. |
void |
saveNodeInternalsToPredParams(ModelContentWO pConf,
boolean saveKeysAndPatterns)
Save internal node settings to a model content object. |
void |
setPureEnough(boolean pureEnough)
Set the marker field for the purity. |
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, 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 |
---|
DecisionTreeNodeLeaf()
public DecisionTreeNodeLeaf(Node xmlNode, DataCellStringMapper mapper)
xmlNode
- XML node containing infomapper
- map translating column names to DataCell
s and vice
versapublic DecisionTreeNodeLeaf(int nodeId, DataCell majorityClass, LinkedHashMap<DataCell,Double> classCounts)
nodeId
- the id of this nodemajorityClass
- the majority class of the records in this nodeclassCounts
- the class distribution of the data in this nodeMethod Detail |
---|
public 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)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 attriubte 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 attriubte for example)public Set<RowKey> coveredPattern()
coveredPattern
in class DecisionTreeNode
public String getStringSummary()
getStringSummary
in class DecisionTreeNode
public 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 void loadNodeInternalsFromPredParams(ModelContentRO pConf) throws InvalidSettingsException
loadNodeInternalsFromPredParams
in class DecisionTreeNode
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 boolean getAllowsChildren()
getAllowsChildren
in interface TreeNode
getAllowsChildren
in class DecisionTreeNode
true
if the receiver allows childrenpublic int getCountOfSubtree()
getCountOfSubtree
in class DecisionTreeNode
public boolean isPureEnough()
public void setPureEnough(boolean pureEnough)
pureEnough
- true if this leaf should be marked as pure enough
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |