- 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
public final class SVMPredictor extends AbstractPredictor
Operator responsible for classification based on a SVM PMML model. This supports eitherCSVCSVMs orone-classSVMs. We distinguish the two cases by the presence ofPMMLModelSpec.getTargetCols(). If there are zero target columns, it is assumed to be aone-classSVM. Otherwise, there must be exactly of column of typeTokenTypeConstant.STRING, in which case it is aCSVCSVM.For
CSVCSVMs, the PMML is expected to containSupportVectorMachine's withSupportVectorMachine#getTargetCategory()andSupportVectorMachine#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-classSVMs, target category and alternate target category will be ignored. The result will either be "-1" if theSupportVectorMachineevaluated to a number less that zero or "1" if greater than zero.NOTE: this operator is non-parallel
-
-
Field Summary
Fields Modifier and Type Field Description static StringFIELD_WINNERConstant for the winner field.
-
Constructor Summary
Constructors Constructor Description SVMPredictor()Creates a newSVMPredictor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeMetadata(StreamingMetadataContext ctx)Default 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, 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
-
FIELD_WINNER
public static final String FIELD_WINNER
Constant for the winner field.- See Also:
- Constant Field Values
-
-
Method Detail
-
computeMetadata
protected void computeMetadata(StreamingMetadataContext ctx)
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
protected RecordTokenType predictedType(PMMLModelSpec modelSpec)
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
protected void execute(PMMLModel pmml, RecordValued input, ScalarSettable[] predictedFields)
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).
-
-