本文整理汇总了Java中hex.genmodel.easy.prediction.MultinomialModelPrediction类的典型用法代码示例。如果您正苦于以下问题:Java MultinomialModelPrediction类的具体用法?Java MultinomialModelPrediction怎么用?Java MultinomialModelPrediction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultinomialModelPrediction类属于hex.genmodel.easy.prediction包,在下文中一共展示了MultinomialModelPrediction类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPredictMultinomialProstate
import hex.genmodel.easy.prediction.MultinomialModelPrediction; //导入依赖的package包/类
@Test
public void testPredictMultinomialProstate() throws Exception {
URL mojoSource = StackedEnsembleRegressionMojoTest.class.getResource("multinomial.zip");
assertNotNull(mojoSource);
System.out.println(mojoSource);
MojoReaderBackend reader = MojoReaderBackendFactory.createReaderBackend(mojoSource, MojoReaderBackendFactory.CachingStrategy.DISK);
MojoModel model = ModelMojoReader.readFrom(reader);
EasyPredictModelWrapper modelWrapper = new EasyPredictModelWrapper(model);
MultinomialModelPrediction pred = (MultinomialModelPrediction) modelWrapper.predict(new RowData() {{
put("CAPSULE", "0");
put("AGE", "65");
put("DPROS", "2");
put("DCAPS", "1");
put("PSA", "1.4");
put("VOL", "0");
put("GLEASON", "6");
}});
assertEquals(1, pred.labelIndex);
assertEquals("1", pred.label);
assertArrayEquals(new double[]{0.006592327, 0.901237, 0.09217069}, pred.classProbabilities, 1e-5);
}