dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.29k stars 5.92k forks source link

Other Estimators and trainers #13869

Closed nfnpmc closed 5 years ago

nfnpmc commented 5 years ago

Any thing other than mlContext.Regression.Trainers? Give us a clue.

AB#1579020


Document details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

luisquintanilla commented 5 years ago

Hi @nfnpmc ,

Thank you for your question. Regression is just one of the many model types supported by ML.NET. This sample is illustrating how to load / save models which is supported by the other model types. You may find the following resources helpful:

https://docs.microsoft.com/en-us/dotnet/machine-learning/how-to-choose-an-ml-net-algorithm

https://docs.microsoft.com/en-us/dotnet/api/microsoft.ml.trainers?view=ml-dotnet

https://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/

nfnpmc commented 5 years ago

Hi Luis,Thanks for your prompt response.I guess I wasn't very specific. I was looking at Working with separate data preparation and model pipelines My estimator chain (called pipline) is for a Tensorflow model and if I doTransformerChain transformer = pipeline.Fit(data);I think I end up with a trained model (transformer )? If not and I wanted to do Microsoft.ML.Trainers.SdcaRegressionTrainer sdcaEstimator = context.Regression.Trainers.Sdca();             RegressionPredictionTransformer trainedModel = sdcaEstimator.Fit(transformedData); What Trainer should I use?Aha! I have just spotted "LbfgsMaximumEntropy" .Append(context.Transforms.ExtractPixels(outputColumnName: "input",                                                          interleavePixelColors: ImageNetSettings.channelsLast,                                                          offsetImage: ImageNetSettings.mean)) .Append(tfModel.ScoreTensorFlowModel(outputColumnNames: new[] { "softmax2_pre_activation" },                                                      inputColumnNames: new[] { "input" },                                                      addBatchDimensionInput: true)) .Append(context.MulticlassClassification.Trainers.LbfgsMaximumEntropy(labelColumnName: "Label",                                                                                       featureColumnName: "softmax2_pre_activation")) .Append(context.Transforms.Conversion.MapKeyToValue("Prediction", "PredictedLabel"));

so, Microsoft.ML.Trainers.LbfgsMaximumEntropyMulticlassTrainer Estimator = context.MulticlassClassification.Trainers.LbfgsMaximumEntropy(); MulticlassPredictionTransformer trainedModel = Estimator.Fit(transformedData); Do I have it? So now to what I was trying to achieve:Save a system and reload it so I can train it again on different data.And again ...

When I load them I will end up with 2 ITransformers. // Load data preparation pipeline and trained model ITransformer dataPrepPipeline = mlContext.Model.Load("data_preparation_pipeline.zip",out dataPrepPipelineSchema); ITransformer trainedModel = mlContext.Model.Load("model.zip", out modelSchema);I will try it out, thank you.

Regards, Peter

On Friday, 16 August 2019, 15:54:43 BST, Luis Quintanilla <notifications@github.com> wrote:  

Hi @nfnpmc ,

Thank you for your question. Regression is just one of the many model types supported by ML.NET. This sample is illustrating how to load / save models which is supported by the other model types. You may find the following resources helpful:

https://docs.microsoft.com/en-us/dotnet/machine-learning/how-to-choose-an-ml-net-algorithm

https://docs.microsoft.com/en-us/dotnet/api/microsoft.ml.trainers?view=ml-dotnet

https://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.