org.knime.base.node.mine.decisiontree2.learner
Class SplitNominalBinary

java.lang.Object
  extended by org.knime.base.node.mine.decisiontree2.learner.Split
      extended by org.knime.base.node.mine.decisiontree2.learner.SplitNominal
          extended by org.knime.base.node.mine.decisiontree2.learner.SplitNominalBinary

public class SplitNominalBinary
extends SplitNominal

This class determines the best binary split for a nominal attribute. The split consists of subsets for both partitions.

Author:
Christoph Sieb, University of Konstanz

Field Summary
static int LEFT_PARTITION
          index for left partition of a binary nominal split.
static int RIGHT_PARTITION
          index for right partition of a binary nominal split.
 
Fields inherited from class org.knime.base.node.mine.decisiontree2.learner.Split
m_splitQualityMeasure
 
Constructor Summary
SplitNominalBinary(InMemoryTable table, int attributeIndex, SplitQualityMeasure splitQualityMeasure, double minObjectsCount, int maxNumDifferentValues)
          Constructs the best split for the given nominal attribute.
 
Method Summary
 boolean canBeFurtherUsed()
          Binary nominal splits can be further used.
 int[] getIntMappingsLeftPartition()
          Returns an array of integer mappings corresponding to the left partition nominal values.
 int[] getIntMappingsRightPartition()
          Returns an array of integer mappings corresponding to the right partition nominal values.
 int getNumberPartitions()
          The number of partitions of a binary nominal split is 2.
 int getPartitionForRow(DataRowWeighted row)
          Returns the partition the given row belongs to according to this split.
 double[] getPartitionWeights()
          Returns the partition weights.
static void main(String[] args)
          Main.
 
Methods inherited from class org.knime.base.node.mine.decisiontree2.learner.SplitNominal
getSplitValues
 
Methods inherited from class org.knime.base.node.mine.decisiontree2.learner.Split
getAttributeIndex, getBestQualityMeasure, getQualityMeasureName, getSplitAttributeName, getTable, isValidSplit, setBestQualityMeasure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT_PARTITION

public static final int LEFT_PARTITION
index for left partition of a binary nominal split.

See Also:
Constant Field Values

RIGHT_PARTITION

public static final int RIGHT_PARTITION
index for right partition of a binary nominal split.

See Also:
Constant Field Values
Constructor Detail

SplitNominalBinary

public SplitNominalBinary(InMemoryTable table,
                          int attributeIndex,
                          SplitQualityMeasure splitQualityMeasure,
                          double minObjectsCount,
                          int maxNumDifferentValues)
Constructs the best split for the given nominal attribute. The results can be retrieved from getter methods.

Parameters:
table - the attribute list for which to create the split
attributeIndex - the index of the attribute for which to calculate the split
splitQualityMeasure - the split quality measure (e.g. gini or gain ratio)
minObjectsCount - the minimum number of objects in at least two partitions
maxNumDifferentValues - the maximum number of different nominal values for which all possible subsets are calculated; if above this threshold, a heuristic is applied
Method Detail

getNumberPartitions

public int getNumberPartitions()
The number of partitions of a binary nominal split is 2. Return the number of partitions resulting from this split.

Specified by:
getNumberPartitions in class Split
Returns:
the number of partitions resulting from this split

canBeFurtherUsed

public boolean canBeFurtherUsed()
Binary nominal splits can be further used. Returns true if it makes sense to use this split's attribute further in deeper levels, false if not.

Specified by:
canBeFurtherUsed in class Split
Returns:
true if it makes sense to use this split's attribute further in deeper levels, false if not

getPartitionForRow

public int getPartitionForRow(DataRowWeighted row)
Returns the partition the given row belongs to according to this split. If the value of the split attribute is missing (i.e. NaN) -1 is returned.

Specified by:
getPartitionForRow in class Split
Parameters:
row - the row for which to get the partition index
Returns:
the partition the given row belongs to according to this split; if the value of the split attribute is missing (i.e. NaN) -1 is returned

getIntMappingsRightPartition

public int[] getIntMappingsRightPartition()
Returns an array of integer mappings corresponding to the right partition nominal values. (This used to be the "false" partition.)

Returns:
an array of integer mappings corresponding to the right partition nominal values

getIntMappingsLeftPartition

public int[] getIntMappingsLeftPartition()
Returns an array of integer mappings corresponding to the left partition nominal values. (This used to be the "true" partition.)

Returns:
an array of integer mappings corresponding to the left partition nominal values

getPartitionWeights

public double[] getPartitionWeights()
Returns the partition weights. The weights represent the relative frequency of valid rows per partition. The weights are normally used to adapt the weight of rows whose split value is missing. Such a row is then assigned to each parition with the adapted weight.

Specified by:
getPartitionWeights in class Split
Returns:
the partition weights

main

public static void main(String[] args)
Main. Small test for GrayCodeCounter.

Parameters:
args - command line arguments


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.