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

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.

主站蜘蛛池模板: 洪洞县| 扶沟县| 浦东新区| 斗六市| 富川| 桂平市| 宁国市| 元谋县| 息烽县| 福鼎市| 当雄县| 南城县| 右玉县| 安新县| 崇文区| 云阳县| 鹤岗市| 旬邑县| 房产| 延津县| 易门县| 博白县| 佛学| 锡林浩特市| 邻水| 务川| 长宁区| 霍山县| 孝昌县| 衡山县| 梧州市| 习水县| 赤水市| 来凤县| 无为县| 浮梁县| 怀宁县| 铜鼓县| 洪泽县| 翼城县| 柏乡县|