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

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.

主站蜘蛛池模板: 公安县| 南京市| 宜宾县| 凤山市| 宣威市| 宁波市| 澄江县| 依安县| 疏附县| 汉川市| 三明市| 乃东县| 乌恰县| 鄂温| 金乡县| 瑞金市| 香格里拉县| 久治县| 上栗县| 孝感市| 铜梁县| 鲁甸县| 金川县| 同仁县| 桃园县| 精河县| 科尔| 阿克陶县| 宿松县| 宁安市| 石家庄市| 闵行区| 定州市| 玛纳斯县| 裕民县| 霍林郭勒市| 中西区| 洞口县| 阜南县| 手机| 广安市|