官术网_书友最值得收藏!

The BaseML class

The BaseML class, as discussed earlier, is going to contain the common code between our Trainer and Predictor classes, starting with this chapter. Over the remainder of the book, we will build on top of the BaseML class defined as follows:

using System;
using System.IO;

using chapter02.Common;

using Microsoft.ML;

namespace chapter02.ML.Base
{
public class BaseML
{
protected static string ModelPath => Path.Combine(AppContext.BaseDirectory, Constants.MODEL_FILENAME);

protected readonly MLContext MlContext;

protected BaseML()
{
MlContext = new MLContext(2020);
}
}
}

For all ML.NET applications in both training and predictions, an MLContext object is required. Initializing the object with a specific seed value is needed to create more consistent results during the testing component. Once a model is loaded, the seed value (or lack thereof) does not affect the output.

主站蜘蛛池模板: 眉山市| 潜江市| 会同县| 临潭县| 灵寿县| 平塘县| 安阳市| 遂昌县| 长春市| 石景山区| 镇坪县| 文山县| 祁连县| 沂南县| 孟村| 海丰县| 怀来县| 柘城县| 岑溪市| 安吉县| 岱山县| 利辛县| 临城县| 平邑县| 丰宁| 阿瓦提县| 贵港市| 延安市| 双峰县| 尤溪县| 滦平县| 翁牛特旗| 洪洞县| 鄢陵县| 绥化市| 高州市| 阿克陶县| 六盘水市| 嫩江县| 登封市| 高尔夫|