- 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.
推薦閱讀
- DevOps:軟件架構(gòu)師行動(dòng)指南
- 認(rèn)識(shí)編程:以Python語(yǔ)言講透編程的本質(zhì)
- Java加密與解密的藝術(shù)(第2版)
- Julia機(jī)器學(xué)習(xí)核心編程:人人可用的高性能科學(xué)計(jì)算
- 深入淺出DPDK
- Java設(shè)計(jì)模式及實(shí)踐
- Python機(jī)器學(xué)習(xí)編程與實(shí)戰(zhàn)
- jQuery開(kāi)發(fā)基礎(chǔ)教程
- Python算法從菜鳥(niǎo)到達(dá)人
- C語(yǔ)言程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo) (第2版)
- IDA Pro權(quán)威指南(第2版)
- ASP.NET 4.0 Web程序設(shè)計(jì)
- IPython Interactive Computing and Visualization Cookbook
- scikit-learn Cookbook(Second Edition)
- MongoDB Cookbook(Second Edition)