org.knime.base.node.mine.regression
Class PMMLRegressionContentHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.knime.core.node.port.pmml.PMMLContentHandler
          extended by org.knime.base.node.mine.regression.PMMLRegressionContentHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class PMMLRegressionContentHandler
extends PMMLContentHandler

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
PMMLRegressionContentHandler(PMMLPortObjectSpec spec)
          Creates a new PMML content handler for regression models.
PMMLRegressionContentHandler(PMMLRegressionPortObject po)
          Creates a new PMML content handler for regression models based on an existing port object.
 
Method Summary
 void characters(char[] ch, int start, int length)
          
 void checkTargetField(String targetFieldName)
          Checks if the given target field name exists in this model.
 void checkValidity()
          Checks if the internal regression has been set and if all predictors are assigned.
 void endDocument()
          
 void endElement(String uri, String localName, String name)
          
 String getAlgorithmName()
           
 String getModelName()
          Returns the model's name.
 PMMLRegressionPortObject.RegressionTable getRegressionTable()
           
 String getTargetField()
          Get the response column name as said in the spec or "Response" if none is set.
 void setAlgorithmName(String algorithmName)
           
 void setModelName(String modelName)
           
 void setRegressionTable(PMMLRegressionPortObject.RegressionTable regressionTable)
           
 void startElement(String uri, String localName, String name, Attributes atts)
          
 void writePMMLRegressionModel(TransformerHandler h)
          Writes the PMML regression model to the given handler.
 
Methods inherited from class org.knime.core.node.port.pmml.PMMLContentHandler
endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PMMLRegressionContentHandler

public PMMLRegressionContentHandler(PMMLPortObjectSpec spec)
Creates a new PMML content handler for regression models.

Parameters:
spec - the spec for the regression model

PMMLRegressionContentHandler

public PMMLRegressionContentHandler(PMMLRegressionPortObject po)
Creates a new PMML content handler for regression models based on an existing port object.

Parameters:
po - a PMML regression port object
Method Detail

checkValidity

public void checkValidity()
Checks if the internal regression has been set and if all predictors are assigned. If not an IllegalStateException is thrown.

Throws:
IllegalStateException - if required information is missing

getModelName

public final String getModelName()
Returns the model's name.

Returns:
the model's name

setModelName

public final void setModelName(String modelName)
Parameters:
modelName - the modelName to set

getRegressionTable

public final PMMLRegressionPortObject.RegressionTable getRegressionTable()
Returns:
the regressionTable

getTargetField

public String getTargetField()
Get the response column name as said in the spec or "Response" if none is set.

Returns:
target field name.

checkTargetField

public void checkTargetField(String targetFieldName)
Checks if the given target field name exists in this model.

Parameters:
targetFieldName - a target field name

setRegressionTable

public final void setRegressionTable(PMMLRegressionPortObject.RegressionTable regressionTable)
Parameters:
regressionTable - the regressionTable to set

getAlgorithmName

public final String getAlgorithmName()
Returns:
the algorithmName

setAlgorithmName

public final void setAlgorithmName(String algorithmName)
Parameters:
algorithmName - the algorithmName to set

writePMMLRegressionModel

public void writePMMLRegressionModel(TransformerHandler h)
                              throws SAXException
Writes the PMML regression model to the given handler.

Parameters:
h - a transform handler
Throws:
SAXException - if anything goes wrong while serializing the model

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException

Specified by:
characters in interface ContentHandler
Specified by:
characters in class PMMLContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException

Specified by:
endDocument in interface ContentHandler
Specified by:
endDocument in class PMMLContentHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String name)
                throws SAXException

Specified by:
endElement in interface ContentHandler
Specified by:
endElement in class PMMLContentHandler
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String name,
                         Attributes atts)
                  throws SAXException

Specified by:
startElement in interface ContentHandler
Specified by:
startElement in class PMMLContentHandler
Throws:
SAXException


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.