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.svm.predictor.SVMPredictor
- All Implemented Interfaces:
LogicalOperator
Operator responsible for classification based on a SVM PMML model. This
supports either
CSVC SVMs or one-class SVMs. We distinguish the
two cases by the presence of PMMLModelSpec.getTargetCols(). If there are
zero target columns, it is assumed to be a one-class SVM. Otherwise, there must
be exactly of column of type TokenTypeConstant.STRING, in which case it is
a CSVC SVM.
For CSVC SVMs, the PMML is expected to contain SupportVectorMachine's
with SupportVectorMachine#getTargetCategory() and SupportVectorMachine#getAlternateTargetCategory()
populated. Each of the SVM's are evaluated, adding a "vote" to either target category or
alternate target category. The predicted value is that receiving the most votes.
For one-class SVMs, target category and alternate target category will be
ignored. The result will either be "-1" if the SupportVectorMachine evaluated
to a number less that zero or "1" if greater than zero.
NOTE: this operator is non-parallel
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDefault implementation of computeMetadata.protected voidexecute(PMMLModel pmml, RecordValued input, ScalarSettable[] predictedFields) Called to perform prediction.protected RecordTokenTypepredictedType(PMMLModelSpec modelSpec) Given the model spec, returns the predicted type.Methods inherited from class com.pervasive.datarush.analytics.util.AbstractPredictor
execute, getInput, getModel, getOutput, pushPrediction, stepNextMethods inherited from class com.pervasive.datarush.operators.ExecutableOperator
cloneForExecution, getNumInputCopies, getPortSettings, handleInactiveOutputMethods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
Field Details
-
FIELD_WINNER
Constant for the winner field.- See Also:
-
-
Constructor Details
-
SVMPredictor
public SVMPredictor()Creates a newSVMPredictor.
-
-
Method Details
-
computeMetadata
Description copied from class:AbstractPredictorDefault implementation of computeMetadata.- Output type is set to input type plus
predictedType - Input data ordering ( if ordered ) is preserved
- Input data partitioning ( if partitioned ) is preserved
- Overrides:
computeMetadatain classAbstractPredictor- Parameters:
ctx- the context
- Output type is set to input type plus
-
predictedType
Description copied from class:AbstractPredictorGiven 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:
predictedTypein classAbstractPredictor- Parameters:
modelSpec- the model metadata- Returns:
- the predicted type
-
execute
Description copied from class:AbstractPredictorCalled 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 thepredictedFieldsarray and then invokeAbstractPredictor.pushPrediction(). Subclasses should not invokepushEndOfDatasince that is automatically handled by the base class.- Specified by:
executein classAbstractPredictor- Parameters:
pmml- 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).
-