當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。