org.knime.base.node.mine.svm
Class PMMLSVMPortObject

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

public class PMMLSVMPortObject
extends PMMLPortObject

A PMMLPortObject responsible for transforming a SupportVectorMachine Svm into a PMML file.

Author:
cebron, University of Konstanz

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.knime.core.node.port.PortObject
PortObject.PortObjectSerializer<T extends PortObject>
 
Field Summary
static PortType TYPE
          PMML SVM 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
PMMLSVMPortObject()
          Empty constructor.
PMMLSVMPortObject(PMMLPortObjectSpec spec, Kernel kernel, Svm... svms)
          Constructor.
 
Method Summary
protected  void addHypertangentKernel(TransformerHandler handler, Kernel kernel)
          Writes the PMML sigmoid kernel attributes.
protected  void addKernel(TransformerHandler handler, Kernel kernel)
          Writes the PMML kernel attributes.
protected  void addPolynomialKernel(TransformerHandler handler, Kernel kernel)
          Writes the PMML polynomial kernel attributes.
protected  void addRBFKernel(TransformerHandler handler, Kernel kernel)
          Writes the PMML RBF kernel attributes.
protected  void addSVMs(TransformerHandler handler, Svm[] svms)
          Writes the PMML support vector machines.
protected  void addTargets(TransformerHandler handler, String classcolName, String[] targetVals)
          Writes the PMML target attributes.
protected  void addVectorDictionary(TransformerHandler handler, Svm[] svms, List<String> colNames)
          Writes the PMML VectorDictionary containing all support vectors for all support vector machines.
 Kernel getKernel()
           
 String getSummary()
          Get a short summary of this PortObject.
 Svm[] getSvms()
           
 void loadFrom(PMMLPortObjectSpec spec, InputStream in, String version)
          
 void setKernel(Kernel kernel)
           
 void setSvms(Svm[] svms)
           
protected  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 SVM port type.

Constructor Detail

PMMLSVMPortObject

public PMMLSVMPortObject()
Empty constructor.


PMMLSVMPortObject

public PMMLSVMPortObject(PMMLPortObjectSpec spec,
                         Kernel kernel,
                         Svm... svms)
Constructor.

Parameters:
spec - the PMMLPortObjectSpec of the training table.
kernel - the Kernel of the Svm.
svms - the trained Svms.
Method Detail

getKernel

public Kernel getKernel()
Returns:
the kernel

setKernel

public void setKernel(Kernel kernel)
Parameters:
kernel - the kernel to set

getSvms

public Svm[] getSvms()
Returns:
the svms

setSvms

public void setSvms(Svm[] svms)
Parameters:
svms - the svms to set

writePMMLModel

protected 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

addTargets

protected void addTargets(TransformerHandler handler,
                          String classcolName,
                          String[] targetVals)
                   throws SAXException
Writes the PMML target attributes.

Parameters:
handler - to write to
classcolName - name of the class column.
targetVals - the target values of the SVMs
Throws:
SAXException - if something goes wrong.

addKernel

protected void addKernel(TransformerHandler handler,
                         Kernel kernel)
                  throws SAXException
Writes the PMML kernel attributes.

Parameters:
handler - to write to.
kernel - the used Kernel of the SVM.
Throws:
SAXException - if something goes wrong.

addPolynomialKernel

protected void addPolynomialKernel(TransformerHandler handler,
                                   Kernel kernel)
                            throws SAXException
Writes the PMML polynomial kernel attributes.

Parameters:
handler - to write to.
kernel - the used Kernel of the SVM.
Throws:
SAXException - if something goes wrong.

addHypertangentKernel

protected void addHypertangentKernel(TransformerHandler handler,
                                     Kernel kernel)
                              throws SAXException
Writes the PMML sigmoid kernel attributes.

Parameters:
handler - to write to.
kernel - the used Kernel of the SVM.
Throws:
SAXException - if something goes wrong.

addRBFKernel

protected void addRBFKernel(TransformerHandler handler,
                            Kernel kernel)
                     throws SAXException
Writes the PMML RBF kernel attributes.

Parameters:
handler - to write to.
kernel - the used Kernel of the SVM.
Throws:
SAXException - if something goes wrong.

addVectorDictionary

protected void addVectorDictionary(TransformerHandler handler,
                                   Svm[] svms,
                                   List<String> colNames)
                            throws SAXException
Writes the PMML VectorDictionary containing all support vectors for all support vector machines.

Parameters:
handler - to write to.
svms - the trained Support Vector Machines.
colNames - the column names in the training data.
Throws:
SAXException - if something goes wrong.

addSVMs

protected void addSVMs(TransformerHandler handler,
                       Svm[] svms)
                throws SAXException
Writes the PMML support vector machines.

Parameters:
handler - to write to.
svms - the trained support vector machines.
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.