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

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.

主站蜘蛛池模板: 历史| 沈阳市| 英超| 岳阳市| 武汉市| 六安市| 普陀区| 闻喜县| 陆丰市| 安阳县| 高陵县| 永定县| 紫云| 南召县| 亚东县| 沈丘县| 喀喇| 嘉祥县| 湟源县| 永和县| 九龙城区| 建湖县| 府谷县| 墨脱县| 丘北县| 子洲县| 冕宁县| 宜宾市| 上虞市| 丹阳市| 红桥区| 台东县| 阳西县| 循化| 和林格尔县| 乌海市| 马边| 永德县| 许昌县| 阿拉善左旗| 淳化县|