- Hands-On Machine Learning with ML.NET
- Jarred Capellman
- 131字
- 2021-06-24 16:43:35
The Trainer class
In the Trainer class, we will build a new pipeline to train our model. The FeaturizeText transform builds NGrams from the strings data we previously extracted from the files. NGrams are a popular method to create vectors from a string to, in turn, feed the model. You can think of NGrams as breaking a longer string into ranges of characters based on the value of the NGram parameter. A bi-gram, for instance, would take the following sentence, ML.NET is great and convert it into ML-.N-ET-is-gr-ea-t. Lastly, we build the SdcaLogisticRegression trainer object:
var dataProcessPipeline = MlContext.Transforms.CopyColumns("Label", nameof(FileInput.Label))
.Append(MlContext.Transforms.Text.FeaturizeText("NGrams", nameof(FileInput.Strings)))
.Append(MlContext.Transforms.Concatenate("Features", "NGrams"));
var trainer = MlContext.BinaryClassification.Trainers.SdcaLogisticRegression(labelColumnName: "Label", featureColumnName: "Features");
For those looking to deep dive further into the Transforms Catalog API, check out the documentation from Microsoft here: https://docs.microsoft.com/en-us/dotnet/api/microsoft.ml.transformscatalog?view=ml-dotnet.
推薦閱讀
- LabVIEW程序設計基礎與應用
- Getting Started with ResearchKit
- Instant Typeahead.js
- C語言程序設計案例精粹
- Responsive Web Design by Example
- Instant Ext.NET Application Development
- PySide 6/PyQt 6快速開發與實戰
- Python爬蟲、數據分析與可視化:工具詳解與案例實戰
- Developing SSRS Reports for Dynamics AX
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- 零基礎學HTML+CSS第2版
- 零基礎學SQL(升級版)
- Tkinter GUI Programming by Example
- JavaScript編程精解(原書第3版)
- 瘋狂Java講義精粹