- 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 classPMMLModel.MiningFunctionEnumeration of values for the "functionName" attribute
-
Constructor Summary
Constructors Modifier Constructor Description protectedPMMLModel()Default constructor.protectedPMMLModel(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 voidbuildModelElement(Element element)Subclasses must implement this method to fill-in the contents of the model element.protected ElementfindModelElement(Document document)Subclasses that require custom selection of their model element should override this method.StringgetAnnotationText()Returns the value of theAnnotationsub-element.protected abstract StringgetModelElementName()Return the element name of the primary model element associated with this PMMLModelExplanationgetModelExplanation()Returns the value of theModelExplanationsub-element.PMMLModelSpecgetModelSpec()Returns the meta-information associated with this PMML modelPMMLVersiongetVersion()Returns the PMML version used by this modelprotected voidparse(Document document)To be invoked by subclasses constructor.protected abstract voidparseModelElement(Element element)Parse the given model element into the respective model object.voidsetAnnotationText(String annotationText)Sets the value of theAnnotationsub-element.voidsetModelExplanation(ModelExplanation modelExplanation)Sets the value of theModelExplanationsub-element.voidsetVersion(PMMLVersion version)Sets the PMML version used by this modelDocumenttoPMML()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 theModelExplanationsub-element.- Returns:
- the model explanation
-
setModelExplanation
public void setModelExplanation(ModelExplanation modelExplanation)
Sets the value of theModelExplanationsub-element.- Parameters:
modelExplanation- the model explanation
-
getAnnotationText
public final String getAnnotationText()
Returns the value of theAnnotationsub-element.- Returns:
- the value of the
Annotationsub-element.
-
setAnnotationText
public final void setAnnotationText(String annotationText)
Sets the value of theAnnotationsub-element.- Parameters:
annotationText- the value of theAnnotationsub-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.
-
-