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

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.
主站蜘蛛池模板: 澳门| 南开区| 东乌| 武定县| 达日县| 左权县| 宁晋县| 鹤山市| 若羌县| 同仁县| 嘉黎县| 南投市| 水富县| 常德市| 屏南县| 隆回县| 九江县| 明水县| 西安市| 峨边| 建昌县| 金沙县| 青龙| 扶余县| 平江县| 鹤壁市| 宜君县| 凤翔县| 镇巴县| 彭阳县| 仙桃市| 怀柔区| 嘉荫县| 霍山县| 芦溪县| 鞍山市| 手机| 漳浦县| 泰和县| 河津市| 炉霍县|