本文整理匯總了Java中org.jpmml.evaluator.Computable類的典型用法代碼示例。如果您正苦於以下問題:Java Computable類的具體用法?Java Computable怎麽用?Java Computable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Computable類屬於org.jpmml.evaluator包,在下文中一共展示了Computable類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doEquivalent
import org.jpmml.evaluator.Computable; //導入依賴的package包/類
@Override
public boolean doEquivalent(Object expected, Object actual){
if(actual instanceof Computable){
actual = EvaluatorUtil.decode(actual);
} // End if
if(actual instanceof Number){
actual = TypeUtil.parseOrCast(DataType.FLOAT, actual);
expected = TypeUtil.parseOrCast(DataType.FLOAT, expected);
}
return super.doEquivalent(expected, actual);
}
示例2: evaluate
import org.jpmml.evaluator.Computable; //導入依賴的package包/類
@Test
public void evaluate() throws Exception {
CountingModelEvaluatorFactory evaluatorFactory = new CountingModelEvaluatorFactory();
Evaluator evaluator = createModelEvaluator(evaluatorFactory);
Map<FieldName, ?> arguments = createArguments("sepal_length", 5.1d, "sepal_width", 3.5d, "petal_length", 1.4d, "petal_width", 0.2d);
Map<FieldName, ?> result = evaluator.evaluate(arguments);
assertEquals(1, evaluatorFactory.getMiningModelCount());
assertEquals(5, evaluatorFactory.getTreeModelCount());
assertEquals(1, result.size());
Collection<?> species = (Collection<?>)result.get(FieldName.create("species"));
assertEquals(5, species.size());
for(Object value : species){
assertTrue((value instanceof Computable) & (value instanceof HasEntityId));
}
assertEquals(Arrays.asList("setosa", "setosa", "setosa", "setosa", "versicolor"), EvaluatorUtil.decode(species));
}