當前位置: 首頁>>代碼示例>>Java>>正文


Java FieldValueUtil.create方法代碼示例

本文整理匯總了Java中org.jpmml.evaluator.FieldValueUtil.create方法的典型用法代碼示例。如果您正苦於以下問題:Java FieldValueUtil.create方法的具體用法?Java FieldValueUtil.create怎麽用?Java FieldValueUtil.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jpmml.evaluator.FieldValueUtil的用法示例。


在下文中一共展示了FieldValueUtil.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkArguments(arguments, 2);

	int length = (arguments.get(0)).asInteger();
	if(length < 0){
		throw new FunctionException(this, "Invalid length value " + length);
	}

	String string = (arguments.get(1)).asString();

	// Trim leading whitespace characters (but keep trailing whitespace characters)
	string = CharMatcher.WHITESPACE.trimLeadingFrom(string);

	// Truncate to a fixed length
	string = string.substring(0, Math.min(length, string.length()));

	// Convert to all uppercase characters
	string = string.toUpperCase();

	return FieldValueUtil.create(DataType.STRING, OpType.CATEGORICAL, string);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:23,代碼來源:StringNormalize.java

示例2: parsePairCounts

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
private Map<FieldValue, TargetValueCounts> parsePairCounts(DataType dataType, OpType opType){
	Map<FieldValue, TargetValueCounts> result = new LinkedHashMap<>();

	List<PairCounts> pairCounts = getPairCounts();
	for(PairCounts pairCount : pairCounts){
		FieldValue value = FieldValueUtil.create(dataType, opType, pairCount.getValue());

		TargetValueCounts targetValueCounts = pairCount.getTargetValueCounts();
		if(targetValueCounts == null){
			throw new MissingElementException(pairCount, PMMLElements.PAIRCOUNTS_TARGETVALUECOUNTS);
		}

		result.put(value, targetValueCounts);
	}

	return result;
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:18,代碼來源:RichBayesInput.java

示例3: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){

	if(arguments.size() < 1 || arguments.size() > 2){
		throw new FunctionException(this, "Expected 1 or 2 arguments, got " + arguments.size() + " arguments");
	} // End if

	if(arguments.contains(null)){
		throw new FunctionException(this, "Missing arguments");
	}

	Collection<?> values = FieldValueUtil.getValue(Collection.class, arguments.get(0));

	Boolean biasCorrected = Boolean.FALSE;
	if(arguments.size() > 1){
		biasCorrected = (arguments.get(1)).asBoolean();
	}

	Double result = evaluate(values, biasCorrected);

	return FieldValueUtil.create(DataType.DOUBLE, OpType.CONTINUOUS, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:23,代碼來源:StandardDeviationFunction.java

示例4: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> values){
	checkArguments(values, 2);

	String id = (values.get(0)).asString();

	IMolecularDescriptor molecularDescriptor = getMolecularDescriptor(id);
	if(molecularDescriptor == null){
		throw new FunctionException(this, "No descriptor for \"" + id + "\"");
	}

	String structure = (values.get(1)).asString();

	IAtomContainer atomContainer = getAtomContainer(structure);
	if(atomContainer == null){
		throw new FunctionException(this, "No atom container for \"" + structure + "\"");
	}

	DescriptorValue descriptorValue;

	try {
		descriptorValue = getDescriptorValue(molecularDescriptor, atomContainer);
	} catch(Exception e){
		throw new FunctionException(this, "Failed to get or calculate descriptor value: " + e.toString());
	}

	Object result = getResult(id, molecularDescriptor.getDescriptorNames(), descriptorValue.getValue());

	return FieldValueUtil.create(null, OpType.CONTINUOUS, result);
}
 
開發者ID:vruusmann,項目名稱:qsar.io,代碼行數:31,代碼來源:CDKDescriptorFunction.java

示例5: parseCategories

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
private List<FieldValue> parseCategories(final DataType dataType, final OpType opType){
	List<String> categories = getCategories();

	Function<String, FieldValue> function = new Function<String, FieldValue>(){

		@Override
		public FieldValue apply(String value){
			return FieldValueUtil.create(dataType, opType, value);
		}
	};

	return Lists.transform(categories, function);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:14,代碼來源:GeneralRegressionModelEvaluator.java

示例6: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkArguments(arguments, 2);

	FieldValue left = arguments.get(0);
	FieldValue right = arguments.get(1);

	Boolean result = evaluate((left).compareToValue(right));

	return FieldValueUtil.create(DataType.BOOLEAN, OpType.CATEGORICAL, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:12,代碼來源:ComparisonFunction.java

示例7: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkArguments(arguments, 2);

	FieldValue left = arguments.get(0);
	FieldValue right = arguments.get(1);

	Boolean result = evaluate((left).equalsValue(right));

	return FieldValueUtil.create(DataType.BOOLEAN, OpType.CATEGORICAL, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:12,代碼來源:EqualityFunction.java

示例8: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkArguments(arguments, 2);

	Collection<?> values = FieldValueUtil.getValue(Collection.class, arguments.get(0));

	int percentile = (arguments.get(1)).asInteger();
	if(percentile < 1 || percentile > 100){
		throw new FunctionException(this, "Invalid percentile value " + percentile + ". Must be greater than 0 and equal or less than 100");
	}

	Double result = evaluate(values, percentile);

	return FieldValueUtil.create(DataType.DOUBLE, OpType.CONTINUOUS, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:16,代碼來源:PercentileFunction.java

示例9: getValue

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue getValue(DataType dataType, OpType opType){

	if(this.parsedValue == null){
		this.parsedValue = FieldValueUtil.create(dataType, opType, getValue());
	}

	return this.parsedValue;
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:10,代碼來源:RichCategoricalPredictor.java

示例10: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	StorelessUnivariateStatistic statistic = createStatistic();

	DataType dataType = null;

	// "Missing values in the input to an aggregate function are simply ignored"
	Iterable<FieldValue> values = Iterables.filter(arguments, Predicates.notNull());
	for(FieldValue value : values){
		statistic.increment((value.asNumber()).doubleValue());

		if(dataType != null){
			dataType = TypeUtil.getResultDataType(dataType, value.getDataType());
		} else

		{
			dataType = value.getDataType();
		}
	}

	// "If all inputs are missing, then the result evaluates to a missing value"
	if(statistic.getN() == 0){
		return null;
	}

	Double result = statistic.getResult();

	return FieldValueUtil.create(getResultType(dataType), OpType.CONTINUOUS, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:30,代碼來源:AggregateFunction.java

示例11: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkArguments(arguments, 1);

	// Angle in radians
	Number angle = (arguments.get(0)).asNumber();

	Double result = evaluate(angle);
	if(result.isNaN()){
		throw new NaNResultException();
	}

	return FieldValueUtil.create(DataType.DOUBLE, OpType.CONTINUOUS, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:15,代碼來源:TrigonometricFunction.java

示例12: parseBaselineStrata

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
private Map<FieldValue, BaselineStratum> parseBaselineStrata(DataType dataType, OpType opType){
	Map<FieldValue, BaselineStratum> result = new LinkedHashMap<>();

	List<BaselineStratum> baselineStrata = getBaselineStrata();
	for(BaselineStratum baselineStratum : baselineStrata){
		FieldValue value = FieldValueUtil.create(dataType, opType, baselineStratum.getValue());

		result.put(value, baselineStratum);
	}

	return result;
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:13,代碼來源:RichBaseCumHazardTables.java

示例13: prepare

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue prepare(String value){
	return FieldValueUtil.create(DataType.STRING, OpType.CATEGORICAL, value);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:5,代碼來源:NearestNeighborModelEvaluator.java

示例14: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkVariableArguments(arguments, 2);

	FieldValue value = arguments.get(0);

	List<FieldValue> values = arguments.subList(1, arguments.size());

	Boolean result = evaluate(value.indexInValues(values));

	return FieldValueUtil.create(DataType.BOOLEAN, OpType.CATEGORICAL, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:13,代碼來源:ValueListFunction.java

示例15: evaluate

import org.jpmml.evaluator.FieldValueUtil; //導入方法依賴的package包/類
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	checkArguments(arguments, 1, true);

	FieldValue value = arguments.get(0);

	Boolean result = evaluate(value);

	return FieldValueUtil.create(DataType.BOOLEAN, OpType.CATEGORICAL, result);
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:11,代碼來源:ValueFunction.java


注:本文中的org.jpmml.evaluator.FieldValueUtil.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。