本文整理汇总了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));
}