org.jpmml.converter.AbstractTransformation Java Examples
The following examples show how to use
org.jpmml.converter.AbstractTransformation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LinearSVCModelConverter.java From jpmml-sparkml with GNU Affero General Public License v3.0 | 6 votes |
@Override public MiningModel encodeModel(Schema schema){ LinearSVCModel model = getTransformer(); Transformation transformation = new AbstractTransformation(){ @Override public Expression createExpression(FieldRef fieldRef){ return PMMLUtil.createApply(PMMLFunctions.THRESHOLD) .addExpressions(fieldRef, PMMLUtil.createConstant(model.getThreshold())); } }; Schema segmentSchema = schema.toAnonymousRegressorSchema(DataType.DOUBLE); Model linearModel = LinearModelUtil.createRegression(this, model.coefficients(), model.intercept(), segmentSchema) .setOutput(ModelUtil.createPredictedOutput(FieldName.create("margin"), OpType.CONTINUOUS, DataType.DOUBLE, transformation)); return MiningModelUtil.createBinaryLogisticClassification(linearModel, 1d, 0d, RegressionModel.NormalizationMethod.NONE, false, schema); }