当前位置: 首页>>代码示例>>Java>>正文


Java EvaluationException类代码示例

本文整理汇总了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;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:22,代码来源:VoteDistribution.java

示例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());
	}
}
 
开发者ID:vruusmann,项目名称:qsar.io,代码行数:11,代码来源:CDKDescriptorFunction.java

示例3: getLastPrediction

import org.jpmml.evaluator.EvaluationException; //导入依赖的package包/类
public Node getLastPrediction(){

			if(this.lastPrediction == null){
				throw new EvaluationException("Empty trail");
			}

			return this.lastPrediction;
		}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:9,代码来源:TreeModelEvaluator.java

示例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();
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:33,代码来源:MiningModelEvaluator.java

示例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"));
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:36,代码来源:ClusteringNeighborhoodTest.java

示例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);
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:27,代码来源:ModelNestingTest.java


注:本文中的org.jpmml.evaluator.EvaluationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。