本文整理汇总了Java中org.jpmml.evaluator.EvaluationException类的典型用法代码示例。如果您正苦于以下问题:Java EvaluationException类的具体用法?Java EvaluationException怎么用?Java EvaluationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EvaluationException类属于org.jpmml.evaluator包,在下文中一共展示了EvaluationException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeProbability
import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
private Value<V> computeProbability(String category){
ValueMap<String, V> values = getValues();
if(this.sum == null){
throw new EvaluationException("Vote distribution result has not been computed");
}
Value<V> probability = values.get(category);
if(probability != null){
probability = probability.copy();
if(this.sum.equals(0d)){
throw new UndefinedResultException();
}
probability.divide(this.sum);
}
return probability;
}
示例2: parseAtomContainer
import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
static
public IAtomContainer parseAtomContainer(String structure){
SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
try {
return prepareAtomContainer(parser.parseSmiles(structure));
} catch(CDKException ce){
throw new EvaluationException(ce.toString());
}
}
示例3: getLastPrediction
import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
public Node getLastPrediction(){
if(this.lastPrediction == null){
throw new EvaluationException("Empty trail");
}
return this.lastPrediction;
}
示例4: selectAll
import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
static
private Map<FieldName, ?> selectAll(List<SegmentResult> segmentResults){
ListMultimap<FieldName, Object> result = ArrayListMultimap.create();
Set<FieldName> keys = null;
for(SegmentResult segmentResult : segmentResults){
if(keys == null){
keys = new LinkedHashSet<>(segmentResult.keySet());
} // End if
// Ensure that all List values in the ListMultimap contain the same number of elements
if(!(keys).equals(segmentResult.keySet())){
Function<Object, String> function = new Function<Object, String>(){
@Override
public String apply(Object object){
return PMMLException.formatKey(object);
}
};
throw new EvaluationException("Field sets " + Iterables.transform(keys, function) + " and " + Iterables.transform(segmentResult.keySet(), function) + " do not match");
}
for(FieldName key : keys){
result.put(key, segmentResult.get(key));
}
}
return result.asMap();
}
示例5: evaluate
import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
@Test
public void evaluate() throws Exception {
ModelEvaluator<?> evaluator = createModelEvaluator();
Map<FieldName, ?> arguments = createArguments("marital status", "d", "dependents", 0);
Map<FieldName, ?> result = evaluator.evaluate(arguments);
AffinityDistribution<?> targetValue = (AffinityDistribution<?>)result.get(evaluator.getTargetFieldName());
try {
targetValue.getResult();
fail();
} catch(EvaluationException ee){
// Ignored
}
assertNotNull(targetValue.getPredictionReport());
Collection<String> categories = targetValue.getCategoryValues();
assertEquals(5, categories.size());
for(String category : categories){
assertNotNull(targetValue.getAffinity(category));
assertNotNull(targetValue.getAffinityReport(category));
}
assertEquals(Arrays.asList("3", "1", "4"), (targetValue.getEntityIdRanking()).subList(0, 3));
assertEquals("3", getOutput(result, "neighbor1"));
assertEquals("1", getOutput(result, "neighbor2"));
assertEquals("4", getOutput(result, "neighbor3"));
}
示例6: evaluate
import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
@Test
public void evaluate() throws Exception {
ModelEvaluator<?> evaluator = createModelEvaluator();
List<TargetField> targetFields = evaluator.getTargetFields();
assertEquals(0, targetFields.size());
try {
evaluator.getTargetField();
fail();
} catch(EvaluationException ee){
// Ignored
}
assertEquals(Evaluator.DEFAULT_TARGET_NAME, evaluator.getTargetFieldName());
Map<FieldName, ?> arguments = createArguments("input", 2d);
Map<FieldName, ?> result = evaluator.evaluate(arguments);
assertEquals(1, result.size());
assertEquals(2d * 2d, (Double)getTarget(result, Evaluator.DEFAULT_TARGET_NAME), 1e-8d);
}