- 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.
推薦閱讀
- Java范例大全
- FreeSWITCH 1.6 Cookbook
- 零基礎學Python數據分析(升級版)
- Learning SciPy for Numerical and Scientific Computing(Second Edition)
- Teaching with Google Classroom
- Visual Basic程序設計
- Unity 2D Game Development Cookbook
- 智能手機APP UI設計與應用任務教程
- Android Development Tools for Eclipse
- C語言從入門到精通
- Learning Unreal Engine Game Development
- 數字媒體技術概論
- Mastering Leap Motion
- Spring MVC Cookbook
- Implementing DevOps with Ansible 2