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

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

public class PMMLSimpleSetPredicate
extends PMMLPredicate

Implements a SimpleSetPredicate 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.
 
Fields inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
ATTRIBUTE_KEY, CDATA, NUMBERFORMAT, OPERATOR_KEY, TYPE_KEY
 
Constructor Summary
PMMLSimpleSetPredicate(String attribute, PMMLSetOperator operator)
          Build a new simple set predicate without values.
PMMLSimpleSetPredicate(String attribute, String operator)
          Build a new simple set predicate without values.
 
Method Summary
 Boolean evaluate(DataRow row, DataTableSpec spec)
          Evaluates the predicate for the passed parameters and returns the result.
 PMMLArrayType getArrayType()
          Returns the data type of the contained array.
 String getName()
          Returns the name of the predicate.
 PMMLSetOperator getSetOperator()
           
 Set<String> getValues()
          Returns the array values.
 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 setArrayType(PMMLArrayType arrayType)
          Sets the data type of the contained array.
 void setArrayType(String arrayType)
          Sets the data type of the contained array.
 void setOperator(String op)
          
 void setValues(LinkedHashSet<String> values)
          Sets the array values.
 void setValues(List<String> values)
          Sets the array values.
 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, 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
Constructor Detail

PMMLSimpleSetPredicate

public PMMLSimpleSetPredicate(String attribute,
                              String operator)
Build a new simple set predicate without values.

Parameters:
attribute - the field the predicate is applied on
operator - the string representation of the set operator

PMMLSimpleSetPredicate

public PMMLSimpleSetPredicate(String attribute,
                              PMMLSetOperator operator)
Build a new simple set predicate without values.

Parameters:
attribute - the field the predicate is applied on
operator - the PMML set operator
Method Detail

getArrayType

public PMMLArrayType getArrayType()
Returns the data type of the contained array.

Returns:
the arrayType

setArrayType

public void setArrayType(String arrayType)
Sets the data type of the contained array.

Parameters:
arrayType - the arrayType to set

setArrayType

public void setArrayType(PMMLArrayType arrayType)
Sets the data type of the contained array.

Parameters:
arrayType - the arrayType to set

getSetOperator

public PMMLSetOperator getSetOperator()
Returns:
the operator used for this predicate

setOperator

public void setOperator(String op)

Overrides:
setOperator in class PMMLPredicate
Parameters:
op - the op to set

getValues

public Set<String> getValues()
Returns the array values.

Returns:
the values

setValues

public void setValues(List<String> values)
Sets the array values.

Parameters:
values - the values to set

setValues

public void setValues(LinkedHashSet<String> values)
Sets the array values.

Parameters:
values - the values 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

getName

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

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

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

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.