Module datarush.analytics
Class RegressionPredictor
- java.lang.Object
-
- com.pervasive.datarush.operators.AbstractLogicalOperator
-
- com.pervasive.datarush.operators.StreamingOperator
-
- com.pervasive.datarush.operators.ExecutableOperator
-
- com.pervasive.datarush.analytics.util.AbstractPredictor
-
- com.pervasive.datarush.analytics.regression.RegressionPredictor
-
- All Implemented Interfaces:
LogicalOperator
public class RegressionPredictor extends AbstractPredictor
Apply a regression model to the input data. The model defines the independent variables used to create the model. The input data must contain the same independent variables as fields in the data flow. The predicted value is added to the output data flow. All input fields are also transferred to the output.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PREDICTED_SUFFIX
The default value forgetPredictedFieldSuffix()
.
-
Constructor Summary
Constructors Constructor Description RegressionPredictor()
Construct a new operator instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
execute(PMMLModel model, RecordValued input, ScalarSettable[] predictedFields)
Called to perform prediction.String
getPredictedFieldSuffix()
Get the suffix to add to the target field name.protected RecordTokenType
predictedType(PMMLModelSpec modelSpec)
Given the model spec, returns the predicted type.void
setPredictedFieldSuffix(String predictedFieldSuffix)
Set the suffix to be added to the target field name.-
Methods inherited from class com.pervasive.datarush.analytics.util.AbstractPredictor
computeMetadata, execute, getInput, getModel, getOutput, pushPrediction, stepNext
-
Methods inherited from class com.pervasive.datarush.operators.ExecutableOperator
cloneForExecution, getNumInputCopies, getPortSettings, handleInactiveOutput
-
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
-
-
-
Field Detail
-
PREDICTED_SUFFIX
public static final String PREDICTED_SUFFIX
The default value forgetPredictedFieldSuffix()
.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPredictedFieldSuffix
public String getPredictedFieldSuffix()
Get the suffix to add to the target field name.- Returns:
- target field name suffix
-
setPredictedFieldSuffix
public void setPredictedFieldSuffix(String predictedFieldSuffix)
Set the suffix to be added to the target field name. The suffix is set to "(predicted)" by default.- Parameters:
predictedFieldSuffix
- target field name suffix
-
predictedType
protected RecordTokenType predictedType(PMMLModelSpec modelSpec)
Description copied from class:AbstractPredictor
Given the model spec, returns the predicted type. This should not include the input type ( the input is automatically prepended to the type that is returned )- Specified by:
predictedType
in classAbstractPredictor
- Parameters:
modelSpec
- the model metadata- Returns:
- the predicted type
-
execute
protected void execute(PMMLModel model, RecordValued input, ScalarSettable[] predictedFields)
Description copied from class:AbstractPredictor
Called to perform prediction. Subclasses are expected to loop over the input by callingAbstractPredictor.stepNext()
. For each row of input, subclasses should first set the predicted values in thepredictedFields
array and then invokeAbstractPredictor.pushPrediction()
. Subclasses should not invokepushEndOfData
since that is automatically handled by the base class.- Specified by:
execute
in classAbstractPredictor
- Parameters:
model
- The input PMML modelinput
- The input datapredictedFields
- An array of fields that reference the predicted field locations. The array positionally corresponds to the type returned byAbstractPredictor.predictedType(PMMLModelSpec)
.
-
-