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

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.

主站蜘蛛池模板: 噶尔县| 益阳市| 盐亭县| 南和县| 嘉兴市| 灌阳县| 鹿邑县| 灵宝市| 固始县| 陈巴尔虎旗| 枝江市| 武夷山市| 霍山县| 五大连池市| 武宁县| 南汇区| 武强县| 曲水县| 东兴市| 昌图县| 宜川县| 资溪县| 滦南县| 焦作市| 陆河县| 东乡| 进贤县| 喜德县| 辛集市| 德州市| 山丹县| 泗洪县| 和平县| 玛沁县| 沙田区| 海林市| 兖州市| 惠来县| 资中县| 泰兴市| 和龙市|