- java.lang.Object
-
- com.pervasive.datarush.analytics.pmml.PMMLModel
-
- Direct Known Subclasses:
AbstractPMMLRegressionModel
,GenericPMMLModel
,PMMLAssociationModel
,PMMLClusteringModel
,PMMLNaiveBayesModel
,PMMLSummaryStatisticsModel
,PMMLSupportVectorMachineModel
,PMMLTreeModel
public abstract class PMMLModel extends Object
Base class for PMML object model objects. Provides a basic framework for creating the PMML header, MiningSchema, DataDictionary, etc. Subclasses provide the rest.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PMMLModel.MiningFunction
Enumeration of values for the "functionName" attribute
-
Constructor Summary
Constructors Modifier Constructor Description protected
PMMLModel()
Default constructor.protected
PMMLModel(PMMLModelSpec objectSpec)
Create a model, specifying a model spec.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
buildModelElement(Element element)
Subclasses must implement this method to fill-in the contents of the model element.protected Element
findModelElement(Document document)
Subclasses that require custom selection of their model element should override this method.String
getAnnotationText()
Returns the value of theAnnotation
sub-element.protected abstract String
getModelElementName()
Return the element name of the primary model element associated with this PMMLModelExplanation
getModelExplanation()
Returns the value of theModelExplanation
sub-element.PMMLModelSpec
getModelSpec()
Returns the meta-information associated with this PMML modelPMMLVersion
getVersion()
Returns the PMML version used by this modelprotected void
parse(Document document)
To be invoked by subclasses constructor.protected abstract void
parseModelElement(Element element)
Parse the given model element into the respective model object.void
setAnnotationText(String annotationText)
Sets the value of theAnnotation
sub-element.void
setModelExplanation(ModelExplanation modelExplanation)
Sets the value of theModelExplanation
sub-element.void
setVersion(PMMLVersion version)
Sets the PMML version used by this modelDocument
toPMML()
Returns a PMML document from this PMMLModel.
-
-
-
Constructor Detail
-
PMMLModel
protected PMMLModel(PMMLModelSpec objectSpec)
Create a model, specifying a model spec. Subclasses should mirror this constructor, defining one constructor that takes a model spec.- Parameters:
objectSpec
- the model spec
-
PMMLModel
protected PMMLModel()
Default constructor. Subclasses should define a constructor that takes aDocument
, invokes this constructor and then invokesparse(Document)
.
-
-
Method Detail
-
getVersion
public PMMLVersion getVersion()
Returns the PMML version used by this model- Returns:
- the PMML version
-
setVersion
public void setVersion(PMMLVersion version)
Sets the PMML version used by this model- Parameters:
version
- the PMML version
-
getModelSpec
public final PMMLModelSpec getModelSpec()
Returns the meta-information associated with this PMML model- Returns:
- the meta-information
-
getModelExplanation
public ModelExplanation getModelExplanation()
Returns the value of theModelExplanation
sub-element.- Returns:
- the model explanation
-
setModelExplanation
public void setModelExplanation(ModelExplanation modelExplanation)
Sets the value of theModelExplanation
sub-element.- Parameters:
modelExplanation
- the model explanation
-
getAnnotationText
public final String getAnnotationText()
Returns the value of theAnnotation
sub-element.- Returns:
- the value of the
Annotation
sub-element.
-
setAnnotationText
public final void setAnnotationText(String annotationText)
Sets the value of theAnnotation
sub-element.- Parameters:
annotationText
- the value of theAnnotation
sub-element.
-
toPMML
public final Document toPMML()
Returns a PMML document from this PMMLModel.- Returns:
- the PMML for this model
-
parse
protected final void parse(Document document)
To be invoked by subclasses constructor. By-convension, each subclass should defined a constructor that takes a single argument of typeDocument
.- Parameters:
document
- the PMML document
-
getModelElementName
protected abstract String getModelElementName()
Return the element name of the primary model element associated with this PMML- Returns:
- the element name of the primary model element
-
buildModelElement
protected abstract void buildModelElement(Element element)
Subclasses must implement this method to fill-in the contents of the model element. At the time this method is invoked, the element will have its name and MiningSchema sub-element populated.- Parameters:
element
- the model element
-
parseModelElement
protected abstract void parseModelElement(Element element)
Parse the given model element into the respective model object.- Parameters:
element
- root element of model object
-
findModelElement
protected Element findModelElement(Document document)
Subclasses that require custom selection of their model element should override this method. By default, we find the first element that matchesthe model element name
. In general the default implementation is sufficient; this is primarily intended for PMMLModels whose model element is a PMML extension.- Parameters:
document
- The PMML document.- Returns:
- The model element.
-
-