ML.net预测始终相同

时间:2018-11-21 22:05:21

标签: ml.net

所以我有以下2个测试

此测试不断返回给出的第一答案,并模仿我们对实时数据的预测方式。

if (_bModelPredictor is null)
    _bModelPredictor = bModel.MakePredictionFunction<TestClass, Prediction>(mlContext);

if(assumption is null)
    assumption = new Prediction();  

_bModelPredictor.Predict(new TestClass(myMapper),ref assumption);

DoSomethingWith(assumption );

如果第一个分数为“ XYZ”,则随后的所有测试都将给出相同的答案。

此设置可以在我使用新数据库数据测试模型的情况下起作用:

var result = new Prediction();
var evalution[]= Database.GetTestArray();
var predictor=bModel.MakePredictionFunction<TestClass, Prediction>(mlContext);
for (var i = 0; i < evalution.Length; i++)
{
    r++;
    //holds the value we think it should have (source database)
    var expect = evalution[i].Prediction;

    evalution[i].Trend = string.Empty;

    //evaluates and puts the trend in "result"
    predictor.Predict(new TestClass(evalution[i]),ref result);
    score+= result.actual==expect? 1 :-1;
    ...
}

为什么第一个返回“失败”答案?

0 个答案:

没有答案