Class 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 a Document, invokes this constructor and then invokes parse(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 the ModelExplanation sub-element.
        Returns:
        the model explanation
      • setModelExplanation

        public void setModelExplanation​(ModelExplanation modelExplanation)
        Sets the value of the ModelExplanation sub-element.
        Parameters:
        modelExplanation - the model explanation
      • getAnnotationText

        public final String getAnnotationText()
        Returns the value of the Annotation sub-element.
        Returns:
        the value of the Annotation sub-element.
      • setAnnotationText

        public final void setAnnotationText​(String annotationText)
        Sets the value of the Annotation sub-element.
        Parameters:
        annotationText - the value of the Annotation 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 type Document.
        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 matches the 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.