本文整理汇总了Java中org.jpmml.converter.ModelEncoder类的典型用法代码示例。如果您正苦于以下问题:Java ModelEncoder类的具体用法?Java ModelEncoder怎么用?Java ModelEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelEncoder类属于org.jpmml.converter包,在下文中一共展示了ModelEncoder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: encodeRegressionTable
import org.jpmml.converter.ModelEncoder; //导入依赖的package包/类
@Test
public void encodeRegressionTable(){
ModelEncoder encoder = new ModelEncoder();
GeneralRegressionModel generalRegressionModel = new GeneralRegressionModel();
generalRegressionModel = GeneralRegressionModelUtil.encodeRegressionTable(generalRegressionModel, Collections.<Feature>emptyList(), null, Collections.<Double>emptyList(), null);
assertState(generalRegressionModel, false, false, false);
Feature feature = SchemaUtil.createConstantFeature(encoder, 3d);
generalRegressionModel = GeneralRegressionModelUtil.encodeRegressionTable(generalRegressionModel, Collections.singletonList(feature), 1d, Collections.singletonList(2d), null);
assertState(generalRegressionModel, true, true, false);
assertParameter(generalRegressionModel, "p0", 1d, Collections.<FieldName>emptyList());
assertParameter(generalRegressionModel, "p1", (2d * 3d), Collections.<FieldName>emptyList());
generalRegressionModel = new GeneralRegressionModel();
feature = SchemaUtil.createInteractionFeature(encoder, FieldName.create("x1"), 5d, FieldName.create("x2"));
generalRegressionModel = GeneralRegressionModelUtil.encodeRegressionTable(generalRegressionModel, Collections.singletonList(feature), 1d, Collections.singletonList(2d), null);
assertState(generalRegressionModel, true, true, true);
assertParameter(generalRegressionModel, "p0", 1d, Collections.<FieldName>emptyList());
assertParameter(generalRegressionModel, "p1", (2d * 5d), Arrays.asList(FieldName.create("x1"), FieldName.create("x2")));
}
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:31,代码来源:GeneralRegressionModelUtilTest.java
示例2: createRegressionTable
import org.jpmml.converter.ModelEncoder; //导入依赖的package包/类
@Test
public void createRegressionTable(){
ModelEncoder encoder = new ModelEncoder();
RegressionTable regressionTable = RegressionModelUtil.createRegressionTable(Collections.<Feature>emptyList(), Collections.<Double>emptyList(), null);
assertState(regressionTable, 0d, false, false, false);
Feature feature = SchemaUtil.createConstantFeature(encoder, 3d);
regressionTable = RegressionModelUtil.createRegressionTable(Collections.singletonList(feature), Collections.singletonList(2d), 1d);
assertState(regressionTable, 1d + (2d * 3d), false, false, false);
feature = SchemaUtil.createInteractionFeature(encoder, 3d, FieldName.create("x"), 7d);
regressionTable = RegressionModelUtil.createRegressionTable(Collections.singletonList(feature), Collections.singletonList(2d), 1d);
assertState(regressionTable, 1d, true, false, false);
NumericPredictor numericPredictor = Iterables.getOnlyElement(regressionTable.getNumericPredictors());
assertEquals(FieldName.create("x"), numericPredictor.getName());
assertEquals((Double)(2d * 3d * 7d), (Double)numericPredictor.getCoefficient());
feature = SchemaUtil.createInteractionFeature(encoder, FieldName.create("x1"), 5d, FieldName.create("x2"));
regressionTable = RegressionModelUtil.createRegressionTable(Collections.singletonList(feature), Collections.singletonList(2d), 1d);
assertState(regressionTable, 1d, false, false, true);
PredictorTerm predictorTerm = Iterables.getOnlyElement(regressionTable.getPredictorTerms());
assertEquals((Double)(2d * 5d), (Double)predictorTerm.getCoefficient());
List<FieldRef> fieldRefs = predictorTerm.getFieldRefs();
assertEquals(FieldName.create("x1"), (fieldRefs.get(0)).getField());
assertEquals(FieldName.create("x2"), (fieldRefs.get(1)).getField());
}
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:41,代码来源:RegressionModelUtilTest.java
注:本文中的org.jpmml.converter.ModelEncoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论