org.knime.base.node.mine.decisiontree2
Class PMMLSimplePredicate

java.lang.Object
  extended by org.knime.base.node.mine.decisiontree2.PMMLPredicate
      extended by org.knime.base.node.mine.decisiontree2.PMMLSimplePredicate

public class PMMLSimplePredicate
extends PMMLPredicate

Implements a SimplePredicate as specified in PMML (http://www.dmg.org/v4-0/TreeModel.html).

Author:
Dominik Morent, KNIME.com, Zurich, Switzerland

Nested Class Summary
 
Nested classes/interfaces inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
PMMLPredicate.PMMLPredicates
 
Field Summary
static String NAME
          The string representation of the predicate's XML-element.
protected static String THRESHOLD_KEY
          The key to store the threshold in configurations.
 
Fields inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
ATTRIBUTE_KEY, CDATA, NUMBERFORMAT, OPERATOR_KEY, TYPE_KEY
 
Constructor Summary
PMMLSimplePredicate(String attribute, PMMLOperator operator, String value)
          Build a new simple predicate.
PMMLSimplePredicate(String attribute, String operator, String value)
          Build a new simple predicate.
 
Method Summary
 Boolean evaluate(DataRow row, DataTableSpec spec)
          Evaluates the predicate for the passed parameters and returns the result.
 String getName()
          Returns the name of the predicate.
 void loadFromPredParams(Config conf)
          Load internal predicate settings from a config object.
 void saveToPredParams(Config conf)
          Save internal predicate settings to a config object.
 void setThreshold(String threshold)
           
 String toString()
          
 void writePMML(TransformerHandler handler)
          Writes the PMML XML object for the predicate.
 
Methods inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
cacheSpec, getOperator, getPredicateForConfig, getPredicateForType, getPreviousIndex, getPreviousSpec, getSplitAttribute, setOperator, setOperator, setPreviousIndex, setPreviousSpec, setSplitAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
The string representation of the predicate's XML-element.

See Also:
Constant Field Values

THRESHOLD_KEY

protected static final String THRESHOLD_KEY
The key to store the threshold in configurations.

See Also:
Constant Field Values
Constructor Detail

PMMLSimplePredicate

public PMMLSimplePredicate(String attribute,
                           String operator,
                           String value)
Build a new simple predicate.

Parameters:
attribute - the field the predicate is applied on
operator - the string representation of the operator
value - the value to be compared with (the threshold)

PMMLSimplePredicate

public PMMLSimplePredicate(String attribute,
                           PMMLOperator operator,
                           String value)
Build a new simple predicate.

Parameters:
attribute - the field the predicate is applied on
operator - the PMML operator to be set
value - the value to be compared with (the threshold)
Method Detail

setThreshold

public void setThreshold(String threshold)
Parameters:
threshold - the threshold to set

evaluate

public Boolean evaluate(DataRow row,
                        DataTableSpec spec)
Evaluates the predicate for the passed parameters and returns the result. If values are missing and an evaluation is not possible null is returned.

Specified by:
evaluate in class PMMLPredicate
Parameters:
row - The data row containing the data cells to be evaluated.
spec - The spec for the row.
Returns:
true if the the predicates evaluates to true, false if it evaluates to false, null on missing values

toString

public String toString()

Specified by:
toString in class PMMLPredicate

writePMML

public void writePMML(TransformerHandler handler)
               throws SAXException
Writes the PMML XML object for the predicate.

Specified by:
writePMML in class PMMLPredicate
Parameters:
handler - TransformerHandler for parsing and transforming events
Throws:
SAXException - - any SAX exception, possibly wrapping another exception

getName

public String getName()
Returns the name of the predicate.

Specified by:
getName in class PMMLPredicate
Returns:
the name of the predicate

loadFromPredParams

public void loadFromPredParams(Config conf)
                        throws InvalidSettingsException
Load internal predicate settings from a config object.

Specified by:
loadFromPredParams in class PMMLPredicate
Parameters:
conf - the config object to load from
Throws:
InvalidSettingsException - - if invalid settings are provided

saveToPredParams

public void saveToPredParams(Config conf)
Save internal predicate settings to a config object.

Specified by:
saveToPredParams in class PMMLPredicate
Parameters:
conf - the config object to write into


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.