本文整理汇总了Java中it.uniroma2.sag.kelp.predictionfunction.regressionfunction.UnivariateRegressionFunction类的典型用法代码示例。如果您正苦于以下问题:Java UnivariateRegressionFunction类的具体用法?Java UnivariateRegressionFunction怎么用?Java UnivariateRegressionFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnivariateRegressionFunction类属于it.uniroma2.sag.kelp.predictionfunction.regressionfunction包,在下文中一共展示了UnivariateRegressionFunction类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAccuracy
import it.uniroma2.sag.kelp.predictionfunction.regressionfunction.UnivariateRegressionFunction; //导入依赖的package包/类
@Test
public void testAccuracy() {
LibLinearRegression libLinear = new LibLinearRegression(property, 1, 0.1f, REPRESENTATION_NAME);
libLinear.learn(trainset);
UnivariateRegressionFunction regressor = (UnivariateRegressionFunction) libLinear.getPredictionFunction();
float meanSquaredError = 0;
for(Example ex : testset.getExamples()){
UnivariateRegressionOutput pred = regressor.predict(ex);
float realValue = ex.getRegressionValue(property);
float predictedValue = pred.getScore(property);
meanSquaredError+=(realValue-predictedValue)*(realValue-predictedValue);
}
meanSquaredError/=testset.getNumberOfExamples();
Assert.assertTrue(meanSquaredError<=35.4973 + 0.0001f);
}