Module datarush.analytics
Class PMMLRegressionClassificationModel
- java.lang.Object
-
- com.pervasive.datarush.analytics.pmml.PMMLModel
-
- com.pervasive.datarush.analytics.regression.AbstractPMMLRegressionModel
-
- com.pervasive.datarush.analytics.regression.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.pervasive.datarush.analytics.regression.AbstractPMMLRegressionModel
AbstractPMMLRegressionModel.CategoricalPredictor, AbstractPMMLRegressionModel.ModelType, AbstractPMMLRegressionModel.NormalizationMethod, AbstractPMMLRegressionModel.NumericPredictor, AbstractPMMLRegressionModel.RegressionTable
-
Nested classes/interfaces inherited from class com.pervasive.datarush.analytics.pmml.PMMLModel
PMMLModel.MiningFunction
-
-
Field Summary
Fields Modifier and Type Field Description static String
FUNCTION_NAME
-
Constructor Summary
Constructors Constructor Description PMMLRegressionClassificationModel()
Create an empty model, to be filled in by the addCategory and addPredictor methods or by parse()PMMLRegressionClassificationModel(PMMLModelSpec objectSpec)
PMMLRegressionClassificationModel(Document document)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCategoricalPredictor(String categoryName, AbstractPMMLRegressionModel.CategoricalPredictor predictor)
Adds a categorical predictor to the sub-model that predicts membership in a given category.void
addCategory(String categoryName)
Extend the classifier to predict membership in another class.void
addNumericPredictor(String categoryName, AbstractPMMLRegressionModel.NumericPredictor predictor)
Adds a numeric predictor to the sub-model that predicts membership in a given category.protected void
buildModelElement(Element element)
Subclasses must implement this method to fill-in the contents of the model element.Set<String>
getCategories()
com.pervasive.datarush.analytics.regression.AbstractPMMLRegressionModel.ValuePredictor
getCategoryPredictor(String category, RecordValued input, DoubleSettable target)
Get the likelihood predictor for a particular categoryprotected void
parseModelElement(Element element)
Parse the given model element into the respective model object.void
setIntercept(String categoryName, double intercept)
Sets the intercept of the submodel that predicts membership in a given category.-
Methods inherited from class com.pervasive.datarush.analytics.regression.AbstractPMMLRegressionModel
getModelElementName, getModelName, getNormalizationMethod, isScorable, logistic, setModelName, setNormalizationMethod, setScorable
-
Methods inherited from class com.pervasive.datarush.analytics.pmml.PMMLModel
findModelElement, getAnnotationText, getModelExplanation, getModelSpec, getVersion, parse, setAnnotationText, setModelExplanation, setVersion, toPMML
-
-
-
-
Field Detail
-
FUNCTION_NAME
public static final String FUNCTION_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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 classAbstractPMMLRegressionModel
- 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 classAbstractPMMLRegressionModel
- 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 topredictor
- 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 topredictor
- 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 tointercept
- 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 predictedinput
- the predictor's input recordtarget
- the predictor's output- Returns:
- a likelihood predictor
-
-