public final class SVMPredictor extends AbstractPredictor
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
Modifier and Type | Field and Description |
---|---|
static String |
FIELD_WINNER
Constant for the winner field.
|
Constructor and Description |
---|
SVMPredictor()
Creates a new
SVMPredictor . |
Modifier and Type | Method and Description |
---|---|
protected void |
computeMetadata(StreamingMetadataContext ctx)
Default implementation of computeMetadata.
|
protected void |
execute(PMMLModel pmml,
RecordValued input,
ScalarSettable[] predictedFields)
Called to perform prediction.
|
protected RecordTokenType |
predictedType(PMMLModelSpec modelSpec)
Given the model spec, returns the predicted type.
|
execute, getInput, getModel, getOutput, pushPrediction, stepNext
cloneForExecution, getNumInputCopies, getPortSettings, handleInactiveOutput
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
public static final String FIELD_WINNER
protected void computeMetadata(StreamingMetadataContext ctx)
AbstractPredictor
predictedType
computeMetadata
in class AbstractPredictor
ctx
- the contextprotected RecordTokenType predictedType(PMMLModelSpec modelSpec)
AbstractPredictor
predictedType
in class AbstractPredictor
modelSpec
- the model metadataprotected void execute(PMMLModel pmml, RecordValued input, ScalarSettable[] predictedFields)
AbstractPredictor
AbstractPredictor.stepNext()
. For each row of input, subclasses should first set the predicted values in
the predictedFields
array and then invoke AbstractPredictor.pushPrediction()
.
Subclasses should not invoke pushEndOfData
since that is automatically handled by
the base class.execute
in class AbstractPredictor
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 by AbstractPredictor.predictedType(PMMLModelSpec)
.Copyright © 2016 Actian Corporation. All rights reserved.