- Hands-On Machine Learning with ML.NET
- Jarred Capellman
- 130字
- 2021-06-24 16:43:30
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.
推薦閱讀
- Advanced Machine Learning with Python
- AngularJS Testing Cookbook
- Learning C# by Developing Games with Unity 2020
- JIRA 7 Administration Cookbook(Second Edition)
- HTML5+CSS3網站設計教程
- Unity Shader入門精要
- Mastering Apache Spark 2.x(Second Edition)
- Keras深度學習實戰
- FPGA Verilog開發實戰指南:基于Intel Cyclone IV(進階篇)
- Extending Puppet(Second Edition)
- 西門子S7-200 SMART PLC編程從入門到實踐
- Orleans:構建高性能分布式Actor服務
- Clean Code in C#
- Practical GIS
- Building a Media Center with Raspberry Pi