org.knime.base.node.mine.cluster
Class PMMLClusterPortObject

java.lang.Object
  extended by org.knime.core.node.port.pmml.PMMLPortObject
      extended by org.knime.base.node.mine.cluster.PMMLClusterPortObject
All Implemented Interfaces:
PortObject

public class PMMLClusterPortObject
extends PMMLPortObject

Author:
Fabian Dill, University of Konstanz

Nested Class Summary
static class PMMLClusterPortObject.ComparisonMeasure
          Constants indicating whether the squared euclidean or the euclidean comparison measure should be used.
 
Nested classes/interfaces inherited from interface org.knime.core.node.port.PortObject
PortObject.PortObjectSerializer<T extends PortObject>
 
Field Summary
static PortType TYPE
          PMML Cluster port type.
 
Fields inherited from class org.knime.core.node.port.pmml.PMMLPortObject
CDATA, DATA_DICT, DATA_FIELD, PMML_V3_0, PMML_V3_1, PMML_V3_2, VALUE
 
Constructor Summary
PMMLClusterPortObject()
          Default constructor necessary for loading.
PMMLClusterPortObject(double[][] prototypes, int nrOfClusters, PMMLPortObjectSpec portSpec)
           
 
Method Summary
protected  void addClusteringFields(TransformerHandler handler, List<DataColumnSpec> colSpecs)
          Writes the clustering fields (name).
protected  void addClusters(TransformerHandler handler, double[][] prototypes)
          Writes the actual cluster prototypes.
protected  void addUsedDistanceMeasure(TransformerHandler handler)
          Writes the used distance measure - so far it is euclidean.
 int[] getClusterCoverage()
           
 PMMLClusterPortObject.ComparisonMeasure getComparisonMeasure()
           
 String[] getLabels()
           
 int getNrOfClusters()
           
 double[][] getPrototypes()
           
 String getSummary()
          Get a short summary of this PortObject.
 List<DataColumnSpec> getUsedColumns()
           
 void loadFrom(PMMLPortObjectSpec spec, InputStream in, String version)
          
 void setClusterCoverage(int[] clusterCoverage)
           
 void setClusterLabels(String[] labels)
           
 void setComparisonMeasure(PMMLClusterPortObject.ComparisonMeasure measure)
           
 void writePMMLModel(TransformerHandler handler)
          
 
Methods inherited from class org.knime.core.node.port.pmml.PMMLPortObject
addPMMLContentHandler, getLocalSchemaLocation, getModelType, getPMMLContentHandler, getPortObjectSerializer, getSpec, getViews, save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final PortType TYPE
PMML Cluster port type.

Constructor Detail

PMMLClusterPortObject

public PMMLClusterPortObject()
Default constructor necessary for loading.


PMMLClusterPortObject

public PMMLClusterPortObject(double[][] prototypes,
                             int nrOfClusters,
                             PMMLPortObjectSpec portSpec)
Parameters:
prototypes - the unnormalized prototypes of clusters
nrOfClusters - number of clusters
portSpec - the PMMLPortObjectSpec holding information of the PMML DataDictionary and the PMML MiningSchema
Method Detail

setClusterLabels

public void setClusterLabels(String[] labels)
Parameters:
labels - cluster labels

setClusterCoverage

public void setClusterCoverage(int[] clusterCoverage)
Parameters:
clusterCoverage - how many data points are in each cluster

setComparisonMeasure

public void setComparisonMeasure(PMMLClusterPortObject.ComparisonMeasure measure)
Parameters:
measure - the used comparison measure

getComparisonMeasure

public PMMLClusterPortObject.ComparisonMeasure getComparisonMeasure()
Returns:
the used comparison measure

getUsedColumns

public List<DataColumnSpec> getUsedColumns()
Returns:
used columns

getPrototypes

public double[][] getPrototypes()
Returns:
normalized prototypes

getNrOfClusters

public int getNrOfClusters()
Returns:
number of clusters

getClusterCoverage

public int[] getClusterCoverage()
Returns:
number of covered data points per cluster

getLabels

public String[] getLabels()
Returns:
cluster names

writePMMLModel

public void writePMMLModel(TransformerHandler handler)
                    throws SAXException

Specified by:
writePMMLModel in class PMMLPortObject
Parameters:
handler - the handler responsible for writing the PMML
Throws:
SAXException - if something goes wrong during writing the PMML

addUsedDistanceMeasure

protected void addUsedDistanceMeasure(TransformerHandler handler)
                               throws SAXException
Writes the used distance measure - so far it is euclidean.

Parameters:
handler - to write to
Throws:
SAXException - if something goes wrong

addClusteringFields

protected void addClusteringFields(TransformerHandler handler,
                                   List<DataColumnSpec> colSpecs)
                            throws SAXException
Writes the clustering fields (name).

Parameters:
handler - to write to
colSpecs - column specs of used columns
Throws:
SAXException - if something goes wrong

addClusters

protected void addClusters(TransformerHandler handler,
                           double[][] prototypes)
                    throws SAXException
Writes the actual cluster prototypes.

Parameters:
handler - to write to
prototypes - the normalized prototypes
Throws:
SAXException - if something goes wrong

loadFrom

public void loadFrom(PMMLPortObjectSpec spec,
                     InputStream in,
                     String version)
              throws ParserConfigurationException,
                     SAXException,
                     IOException

Overrides:
loadFrom in class PMMLPortObject
Parameters:
spec - the referring spec of this object
in - the input stream to write to
version - the version (3.0 - 3.1)
Throws:
ParserConfigurationException - if the parser cannot be instantiated
SAXException - if something goes wrong during writing
IOException - if the file cannot be found

getSummary

public String getSummary()
Get a short summary of this PortObject. The return value will be shown in a node port's tooltip, for instance.

Specified by:
getSummary in interface PortObject
Specified by:
getSummary in class PMMLPortObject
Returns:
Summary of the object's content, suitable for a tooltip. Empty strings and null result values are ok (though not encouraged).


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.