Java Code Examples for org.dmg.pmml.OpType#CONTINUOUS
The following examples show how to use
org.dmg.pmml.OpType#CONTINUOUS .
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: TypeUtil.java From jpmml-tensorflow with GNU Affero General Public License v3.0 | 6 votes |
static public OpType getOpType(Output output){ org.tensorflow.DataType dataType = output.dataType(); switch(dataType){ case FLOAT: case DOUBLE: case INT32: case INT64: return OpType.CONTINUOUS; case STRING: case BOOL: return OpType.CATEGORICAL; default: throw new IllegalArgumentException(); } }
Example 2
Source File: TransformerUtil.java From jpmml-sklearn with GNU Affero General Public License v3.0 | 6 votes |
static public OpType getOpType(DataType dataType){ switch(dataType){ case STRING: return OpType.CATEGORICAL; case INTEGER: case FLOAT: case DOUBLE: return OpType.CONTINUOUS; case BOOLEAN: return OpType.CATEGORICAL; case DATE: case DATE_TIME: return OpType.ORDINAL; default: throw new IllegalArgumentException(); } }
Example 3
Source File: ContinuousValue.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 6 votes |
static public FieldValue create(DataType dataType, Object value){ if(value instanceof Collection){ return new CollectionValue(dataType, OpType.CONTINUOUS, (Collection<?>)value); } switch(dataType){ case INTEGER: return new ContinuousInteger(value); case FLOAT: return new ContinuousFloat(value); case DOUBLE: return new ContinuousDouble(value); default: return new ContinuousValue(dataType, value); } }
Example 4
Source File: AppPMMLUtils.java From oryx with Apache License 2.0 | 5 votes |
public static DataDictionary buildDataDictionary( InputSchema schema, CategoricalValueEncodings categoricalValueEncodings) { List<String> featureNames = schema.getFeatureNames(); List<DataField> dataFields = new ArrayList<>(); for (int featureIndex = 0; featureIndex < featureNames.size(); featureIndex++) { String featureName = featureNames.get(featureIndex); OpType opType; DataType dataType; if (schema.isNumeric(featureName)) { opType = OpType.CONTINUOUS; dataType = DataType.DOUBLE; } else if (schema.isCategorical(featureName)) { opType = OpType.CATEGORICAL; dataType = DataType.STRING; } else { // Don't know opType = null; dataType = null; } DataField field = new DataField(FieldName.create(featureName), opType, dataType); if (schema.isCategorical(featureName)) { Objects.requireNonNull(categoricalValueEncodings); categoricalValueEncodings.getEncodingValueMap(featureIndex).entrySet().stream(). sorted(Comparator.comparing(Map.Entry::getKey)). map(Map.Entry::getValue). forEach(value -> field.addValues(new Value(value))); } dataFields.add(field); } return new DataDictionary(dataFields).setNumberOfFields(dataFields.size()); }
Example 5
Source File: TypeUtil.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 5 votes |
static public OpType getOpType(DataType dataType){ switch(dataType){ case STRING: return OpType.CATEGORICAL; case INTEGER: case FLOAT: case DOUBLE: return OpType.CONTINUOUS; case BOOLEAN: return OpType.CATEGORICAL; case DATE: case TIME: case DATE_TIME: return OpType.ORDINAL; case DATE_DAYS_SINCE_0: case DATE_DAYS_SINCE_1960: case DATE_DAYS_SINCE_1970: case DATE_DAYS_SINCE_1980: case TIME_SECONDS: case DATE_TIME_SECONDS_SINCE_0: case DATE_TIME_SECONDS_SINCE_1960: case DATE_TIME_SECONDS_SINCE_1970: case DATE_TIME_SECONDS_SINCE_1980: return OpType.CONTINUOUS; default: throw new IllegalArgumentException(); } }
Example 6
Source File: Transformer.java From jpmml-sklearn with GNU Affero General Public License v3.0 | 4 votes |
@Override public OpType getOpType(){ return OpType.CONTINUOUS; }
Example 7
Source File: Estimator.java From jpmml-sklearn with GNU Affero General Public License v3.0 | 4 votes |
@Override public OpType getOpType(){ return OpType.CONTINUOUS; }
Example 8
Source File: ContinuousDomain.java From jpmml-sklearn with GNU Affero General Public License v3.0 | 4 votes |
@Override public OpType getOpType(){ return OpType.CONTINUOUS; }
Example 9
Source File: ContinuousValue.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 4 votes |
@Override public OpType getOpType(){ return OpType.CONTINUOUS; }
Example 10
Source File: EvaluationContext.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 4 votes |
@Override public OpType getOpType(){ return OpType.CONTINUOUS; }
Example 11
Source File: TargetFieldTest.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 4 votes |
@Test public void getName(){ FieldName name = FieldName.create("y"); DataField dataField = new DataField(name, OpType.CONTINUOUS, DataType.DOUBLE); TargetField targetField = new TargetField(dataField, null, null); assertEquals(name, targetField.getName()); targetField.setName(FieldName.create("label")); assertNotEquals(name, targetField.getName()); targetField.setName(null); assertEquals(name, targetField.getName()); }
Example 12
Source File: TargetFieldTest.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 4 votes |
@Test public void getOpType(){ FieldName name = FieldName.create("y"); DataField dataField = new DataField(name, OpType.CONTINUOUS, DataType.DOUBLE); MiningField miningField = new MiningField(name) .setOpType(OpType.CATEGORICAL); Target target = new Target() .setField(name) .setOpType(OpType.CONTINUOUS); TargetField targetField = new TargetField(dataField, null, null); assertEquals(OpType.CONTINUOUS, targetField.getOpType()); targetField = new TargetField(dataField, miningField, null); assertEquals(OpType.CATEGORICAL, targetField.getOpType()); targetField = new TargetField(dataField, miningField, target); assertEquals(OpType.CONTINUOUS, targetField.getOpType()); }
Example 13
Source File: InputFieldUtilTest.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 3 votes |
@Test public void isDefault(){ FieldName name = FieldName.create("x"); DataField dataField = new DataField(name, OpType.CONTINUOUS, DataType.DOUBLE); MiningField miningField = new MiningField(name); assertTrue(InputFieldUtil.isDefault(dataField, miningField)); miningField.setOpType(OpType.CATEGORICAL); assertFalse(InputFieldUtil.isDefault(dataField, miningField)); }