org.knime.base.node.mine.decisiontree2.model
Class DecisionTreeNodeSplitPMML

java.lang.Object
  extended by org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode
      extended by org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeSplit
          extended by org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeSplitPMML
All Implemented Interfaces:
Serializable, TreeNode

public class DecisionTreeNodeSplitPMML
extends DecisionTreeNodeSplit

Decision tree split node that supports PMML predicates to partition the data. An arbitrary number of childs (>2) is allowed.

Author:
Dominik Morent, KNIME.com, Zurich, Switzerland
See Also:
Serialized Form

Constructor Summary
DecisionTreeNodeSplitPMML()
           
DecisionTreeNodeSplitPMML(int nodeId, DataCell majorityClass, LinkedHashMap<DataCell,Double> classCounts, String splitAttribute, PMMLPredicate[] splitPredicates, DecisionTreeNode[] children)
          Constructor of base class.
DecisionTreeNodeSplitPMML(int nodeId, DataCell majorityClass, LinkedHashMap<DataCell,Double> classCounts, String splitAttribute, PMMLPredicate[] splitPredicates, DecisionTreeNode[] children, int defaultChild)
          Constructor of base class.
 
Method Summary
 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 addCoveredPattern(DataCell cell, DataRow row, DataTableSpec spec, double weight)
          Add patterns given as a row of values if they fall within a specific node.
 Set<RowKey> coveredPattern()
          
 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.
 DecisionTreeNode getDefaultChild()
           
 int getDefaultChildIndex()
           
 PMMLPredicate[] getSplitPred()
          Returns the split predicate array of this node.
 String getStringSummary()
          
 void loadNodeSplitInternalsFromPredParams(ModelContentRO pConf)
          Load internal SplitNode settings from a ModelContent object.
 void saveNodeSplitInternalsToPredParams(ModelContentWO pConf)
          save internal SplitNode settings to a ModelContent object.
 void setDefaultChild(int defaultChild)
           
 
Methods inherited from class org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeSplit
addCoveredColor, addCoveredPattern, addNode, addNodeToTreeDepthFirst, children, getAllowsChildren, getChildAt, getChildCount, getChildNodeAt, getChildren, getCountOfSubtree, getIndex, getMVStrategy, getNodeClassWeights, getNTCStrategy, getSplitAttr, isLeaf, loadNodeInternalsFromPredParams, makeRoomForKids, replaceChild, saveNodeInternalsToPredParams, setChildNodeIndex, setMVStrategy, setNTCStrategy
 
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

DecisionTreeNodeSplitPMML

public DecisionTreeNodeSplitPMML()

DecisionTreeNodeSplitPMML

public DecisionTreeNodeSplitPMML(int nodeId,
                                 DataCell majorityClass,
                                 LinkedHashMap<DataCell,Double> classCounts,
                                 String splitAttribute,
                                 PMMLPredicate[] splitPredicates,
                                 DecisionTreeNode[] children)
Constructor of base class. The necessary data is provided directly in the constructor.

Parameters:
nodeId - the id of this node
majorityClass - the majority class of the records in this node
classCounts - the class distribution of the data in this node
splitAttribute - the attribute name on which to split
splitPredicates - the split predicates used to partition the data
children - the children split according to the split values

DecisionTreeNodeSplitPMML

public DecisionTreeNodeSplitPMML(int nodeId,
                                 DataCell majorityClass,
                                 LinkedHashMap<DataCell,Double> classCounts,
                                 String splitAttribute,
                                 PMMLPredicate[] splitPredicates,
                                 DecisionTreeNode[] children,
                                 int defaultChild)
Constructor of base class. The necessary data is provided directly in the constructor.

Parameters:
nodeId - the id of this node
majorityClass - the majority class of the records in this node
classCounts - the class distribution of the data in this node
splitAttribute - the attribute name on which to split
splitPredicates - the split predicates used to partition the data
children - the children split according to the split values
defaultChild - index of the default child (only evaluated with PMMLMissingValueStrategy DEFAULT_CHILD
Method Detail

getDefaultChild

public DecisionTreeNode getDefaultChild()
Returns:
the defaultChild

getDefaultChildIndex

public int getDefaultChildIndex()
Returns:
the defaultChild index

setDefaultChild

public void setDefaultChild(int defaultChild)
Parameters:
defaultChild - the defaultChild to set

getClassCounts

public LinkedHashMap<DataCell,Double> getClassCounts(DataRow row,
                                                     DataTableSpec spec)
                                              throws Exception
Determine class counts for a new pattern given as a row of values. Returns a HashMap listing counts for all classes.

Overrides:
getClassCounts in class DecisionTreeNodeSplit
Parameters:
row - input pattern
spec - the corresponding table spec
Returns:
HashMap class/count
Throws:
Exception - if something went wrong (unknown attriubte for example)

getClassCounts

public LinkedHashMap<DataCell,Double> getClassCounts(DataCell cell,
                                                     DataRow row,
                                                     DataTableSpec spec)
                                              throws Exception
Determine class counts for a new pattern given as a row of values. Returns a HashMap listing counts for all classes.

Specified by:
getClassCounts in class DecisionTreeNodeSplit
Parameters:
cell - the call to be used for classification at this node
row - input pattern
spec - the corresponding table spec
Returns:
HashMap class/count
Throws:
Exception - if something went wrong (unknown attriubte for example)

addCoveredPattern

public void addCoveredPattern(DataCell cell,
                              DataRow row,
                              DataTableSpec spec,
                              double weight)
                       throws Exception
Add patterns given as a row of values if they fall within a specific node. Usually only Leafs will actually hold a list of RowKeys, all intermediate nodes will collect "their" information recursively.

Specified by:
addCoveredPattern in class DecisionTreeNodeSplit
Parameters:
cell - the cell to be used for classification at this node
row - input pattern
spec - the corresponding table spec
weight - the weight of this row (between 0.0 and 1.0)
Throws:
Exception - if something went wrong (unknown attribute for example)

addCoveredColor

public void addCoveredColor(DataCell cell,
                            DataRow row,
                            DataTableSpec spec,
                            double weight)
                     throws Exception
Add colors for patterns given as a row of values if they fall within a specific node.

Specified by:
addCoveredColor in class DecisionTreeNodeSplit
Parameters:
cell - the call to be used for classification at this node
row - input pattern
spec - the corresponding table spec
weight - the weight of this row (between 0.0 and 1.0)
Throws:
Exception - if something went wrong (unknown attribute for example)

coveredPattern

public Set<RowKey> coveredPattern()

Specified by:
coveredPattern in class DecisionTreeNodeSplit
Returns:
set of data cells which are the row keys that are covered by all nodes of this branch

loadNodeSplitInternalsFromPredParams

public void loadNodeSplitInternalsFromPredParams(ModelContentRO pConf)
                                          throws InvalidSettingsException
Load internal SplitNode settings from a ModelContent object.

Specified by:
loadNodeSplitInternalsFromPredParams in class DecisionTreeNodeSplit
Parameters:
pConf - configuration object to load decision tree from.
Throws:
InvalidSettingsException - if something goes wrong

saveNodeSplitInternalsToPredParams

public void saveNodeSplitInternalsToPredParams(ModelContentWO pConf)
save internal SplitNode settings to a ModelContent object.

Specified by:
saveNodeSplitInternalsToPredParams in class DecisionTreeNodeSplit
Parameters:
pConf - configuration object to save decision tree to

getStringSummary

public String getStringSummary()

Specified by:
getStringSummary in class DecisionTreeNode
Returns:
string summary of node content (split, leaf info...)

getSplitPred

public PMMLPredicate[] getSplitPred()
Returns the split predicate array of this node.

Returns:
the split predicate array of this node


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.