org.knime.core.node.port.pmml
Class PMMLPortObjectSpec

java.lang.Object
  extended by org.knime.core.node.port.pmml.PMMLPortObjectSpec
All Implemented Interfaces:
PortObjectSpec

public class PMMLPortObjectSpec
extends Object
implements PortObjectSpec

Author:
Fabian Dill, University of Konstanz

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.knime.core.node.port.PortObjectSpec
PortObjectSpec.PortObjectSpecSerializer<T extends PortObjectSpec>
 
Field Summary
protected static String CDATA
          Constant for CDATA.
protected static String DATA_DICT
          Constant for DataDictionary.
protected static String DATA_FIELD
          Constant for DataField.
protected static String MINING_FIELD
          Constant for MiningField tag.
protected static String MINING_SCHEMA
          Constant for the MiningSchema tag.
protected static String VALUE
          Constant for Value.
 
Constructor Summary
PMMLPortObjectSpec(DataTableSpec dataDictionary, List<String> learningCols, List<String> ignoredCols, List<String> targetCols)
           
 
Method Summary
 DataTableSpec getDataTableSpec()
           
static String getDataType(DataColumnSpec colSpec)
           
 List<DataColumnSpec> getIgnoredCols()
           
 List<String> getIgnoredFields()
           
 List<DataColumnSpec> getLearningCols()
           
 List<String> getLearningFields()
           
static PortObjectSpec.PortObjectSpecSerializer<PMMLPortObjectSpec> getPortObjectSpecSerializer()
           
 List<DataColumnSpec> getTargetCols()
           
 List<String> getTargetFields()
           
 JComponent[] getViews()
          The returned views are displayed in the out port view of the referring node.
static PMMLPortObjectSpec loadFrom(PortObjectSpecZipInputStream in)
           
 void saveTo(PortObjectSpecZipOutputStream out)
           
static void writeDataDictionary(DataTableSpec spec, TransformerHandler handler)
          Convenience method to write a PMML DataDictionary based on the data table spec.
static void writeHeader(TransformerHandler handler)
           
static void writeMiningSchema(PMMLPortObjectSpec portSpec, TransformerHandler handler)
          Writes the MiningSchema based upon the fields of the passed PMMLPortObjectSpec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CDATA

protected static final String CDATA
Constant for CDATA.

See Also:
Constant Field Values

DATA_DICT

protected static final String DATA_DICT
Constant for DataDictionary.

See Also:
Constant Field Values

DATA_FIELD

protected static final String DATA_FIELD
Constant for DataField.

See Also:
Constant Field Values

VALUE

protected static final String VALUE
Constant for Value.

See Also:
Constant Field Values

MINING_FIELD

protected static final String MINING_FIELD
Constant for MiningField tag.

See Also:
Constant Field Values

MINING_SCHEMA

protected static final String MINING_SCHEMA
Constant for the MiningSchema tag.

See Also:
Constant Field Values
Constructor Detail

PMMLPortObjectSpec

public PMMLPortObjectSpec(DataTableSpec dataDictionary,
                          List<String> learningCols,
                          List<String> ignoredCols,
                          List<String> targetCols)
Parameters:
dataDictionary - DataTableSpec describing the training data
learningCols - columns used for learning of the model
ignoredCols - columns ignored while learning the model
targetCols - columns to be predicted
Method Detail

getPortObjectSpecSerializer

public static PortObjectSpec.PortObjectSpecSerializer<PMMLPortObjectSpec> getPortObjectSpecSerializer()
Returns:
the serializer
See Also:
PortObjectSpec

getDataTableSpec

public DataTableSpec getDataTableSpec()
Returns:
the DataTableSpec describing the training data

getLearningFields

public List<String> getLearningFields()
Returns:
those columns used for learning of the model

getLearningCols

public List<DataColumnSpec> getLearningCols()
Returns:
those columns used for learning of the model

getIgnoredFields

public List<String> getIgnoredFields()
Returns:
those columns ignored while learning the model

getIgnoredCols

public List<DataColumnSpec> getIgnoredCols()
Returns:
those columns used for learning of the model

getTargetFields

public List<String> getTargetFields()
Returns:
by the model predicted columns

getTargetCols

public List<DataColumnSpec> getTargetCols()
Returns:
those columns used for learning of the model

writeDataDictionary

public static void writeDataDictionary(DataTableSpec spec,
                                       TransformerHandler handler)
                                throws SAXException
Convenience method to write a PMML DataDictionary based on the data table spec.

Parameters:
spec - the spec to be converted into a PMML DataDictionary
handler - th econtent handler to write to
Throws:
SAXException - if something goes wrong during writing

getDataType

public static String getDataType(DataColumnSpec colSpec)
Parameters:
colSpec - the column spec to get the PMML data type attribute from
Returns:
the PMML data type for the DataColumnSpec

writeMiningSchema

public static void writeMiningSchema(PMMLPortObjectSpec portSpec,
                                     TransformerHandler handler)
                              throws SAXException
Writes the MiningSchema based upon the fields of the passed PMMLPortObjectSpec. Since the MiningSchema is inside the model tag of the PMML file, implementing classes have to take open their model tag, then call this method, write their model content andclose the model tag.

Parameters:
portSpec - based upon this port object spec the mining schema is written
handler - transformartion handler to write to
Throws:
SAXException - if something goes wrong

saveTo

public void saveTo(PortObjectSpecZipOutputStream out)
            throws IOException
Parameters:
out - zipped stream to write the entries to
Throws:
IOException - if something goes wrong

loadFrom

public static PMMLPortObjectSpec loadFrom(PortObjectSpecZipInputStream in)
                                   throws IOException,
                                          InvalidSettingsException
Parameters:
in - stream reading the relevant files
Returns:
a completely loaded port object spec with DataTableSpec, and the sets of learning, ignored and target columns.
Throws:
IOException - if something goes wrong
InvalidSettingsException - if something goes wrong

writeHeader

public static void writeHeader(TransformerHandler handler)
                        throws SAXException
Parameters:
handler - the handler to write to
Throws:
SAXException - if something goes wrong

getViews

public JComponent[] getViews()
The returned views are displayed in the out port view of the referring node. Each component is displayed in an extra tab. The name of the component is used as the title for the tab. It is important that no external members are kept in the component so it can be deleted, when the port object is deleted. If the port object has no view return an empty array.

Specified by:
getViews in interface PortObjectSpec
Returns:
an array of views for the port object spec, each displayed as a tab in the out port view


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.