Class PMMLRegressionClassificationModel


public class PMMLRegressionClassificationModel extends AbstractPMMLRegressionModel
Implementation of a 'maximum likelihood' classifier on top of regression models. The classifier has one RegressionTable for each category whose result on an input record is interpreted as the relative likelihood of the record belonging to that category. The predicted category is the one with the highest likelihood.
  • Field Details

  • Constructor Details

    • PMMLRegressionClassificationModel

      public PMMLRegressionClassificationModel()
      Create an empty model, to be filled in by the addCategory and addPredictor methods or by parse()
    • PMMLRegressionClassificationModel

      public PMMLRegressionClassificationModel(PMMLModelSpec objectSpec)
    • PMMLRegressionClassificationModel

      public PMMLRegressionClassificationModel(Document document)
  • Method Details

    • buildModelElement

      protected void buildModelElement(Element element)
      Description copied from class: PMMLModel
      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.
      Specified by:
      buildModelElement in class AbstractPMMLRegressionModel
      Parameters:
      element - the model element
    • parseModelElement

      protected void parseModelElement(Element element)
      Description copied from class: AbstractPMMLRegressionModel
      Parse the given model element into the respective model object. This implementation only reads the normalizationMethod and scorable attributes. Subclasses SHOULD override this and are responsible for Regression Tables and the function name and target field attributes.
      Overrides:
      parseModelElement in class AbstractPMMLRegressionModel
      Parameters:
      element - root element of model object
    • addCategory

      public void addCategory(String categoryName)
      Extend the classifier to predict membership in another class. Does nothing if it already predicts that class.
      Parameters:
      categoryName -
    • addNumericPredictor

      public void addNumericPredictor(String categoryName, AbstractPMMLRegressionModel.NumericPredictor predictor)
      Adds a numeric predictor to the sub-model that predicts membership in a given category.
      Parameters:
      categoryName - which category the predictor's coefficient applies to
      predictor - the predictor to add
    • addCategoricalPredictor

      public void addCategoricalPredictor(String categoryName, AbstractPMMLRegressionModel.CategoricalPredictor predictor)
      Adds a categorical predictor to the sub-model that predicts membership in a given category.
      Parameters:
      categoryName - which category the predictor's coefficient applies to
      predictor - the predictor to add
    • setIntercept

      public void setIntercept(String categoryName, double intercept)
      Sets the intercept of the submodel that predicts membership in a given category.
      Parameters:
      categoryName - which category the intercept belongs to
      intercept - the value of the intercept
    • getCategories

      public Set<String> getCategories()
      Returns:
      a collection of the categories recognized by this classification model.
    • getCategoryPredictor

      public com.pervasive.datarush.analytics.regression.AbstractPMMLRegressionModel.ValuePredictor getCategoryPredictor(String category, RecordValued input, DoubleSettable target)
      Get the likelihood predictor for a particular category
      Parameters:
      category - the category whose likelihood is to be predicted
      input - the predictor's input record
      target - the predictor's output
      Returns:
      a likelihood predictor