Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoML - how to read values of L1Regularization and L2Regularization and selected algorithm name? #1012

Open
kicaj29 opened this issue Dec 23, 2023 · 0 comments

Comments

@kicaj29
Copy link

kicaj29 commented Dec 23, 2023

Hi

When I use VS designer to generate model it generates for example file MyModel.training.cs with such code which can be used to re-train model using the same paramters.

        public static IEstimator<ITransformer> BuildPipeline(MLContext mlContext)
        {
            // Data process configuration with pipeline data transformations
            var pipeline = mlContext.Transforms.Text.FeaturizeText(inputColumnName:@"col0",outputColumnName:@"col0")      
                                    .Append(mlContext.Transforms.Concatenate(@"Features", new []{@"col0"}))      
                                    .Append(mlContext.Transforms.Conversion.MapValueToKey(outputColumnName:@"col1",inputColumnName:@"col1",addKeyValueAnnotationsAsText:false))      
                                    .Append(mlContext.MulticlassClassification.Trainers.LightGbm(new LightGbmMulticlassTrainer.Options(){NumberOfLeaves=2717,NumberOfIterations=2632,MinimumExampleCountPerLeaf=29,LearningRate=0.0609179057439351,LabelColumnName=@"col1",FeatureColumnName=@"Features",ExampleWeightColumnName=null,Booster=new GradientBooster.Options(){SubsampleFraction=0.999999776672986,FeatureFraction=0.99999999,L1Regularization=1.67496587225263E-09,L2Regularization=0.999999776672986},MaximumBinCountPerFeature=207}))      
                                    .Append(mlContext.Transforms.Conversion.MapKeyToValue(outputColumnName:@"PredictedLabel",inputColumnName:@"PredictedLabel"));

            return pipeline;
        }

If I use AutoML TrialResult experimentResults = await experiment.RunAsync(); I cannot find there name of the algorithm and its params which have been used to generate this mode.

I found this doc https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/train-machine-learning-model-ml-net#extract-model-parameters but in my case any casting ends with null value.

I was trying these casts but every time I see the null value

            model as TransformerChain<MulticlassPredictionTransformer<Microsoft.ML.Trainers.MaximumEntropyModelParameters>>
           model as TransformerChain<MulticlassPredictionTransformer<Microsoft.ML.Trainers.LinearMulticlassModelParameters>>
            model as TransformerChain<MulticlassPredictionTransformer<Microsoft.ML.Trainers.LinearMulticlassModelParametersBase>>
@kicaj29 kicaj29 changed the title AutoML - how read values of L1Regularization and L2Regularization and selected algorithm name? AutoML - how to read values of L1Regularization and L2Regularization and selected algorithm name? Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant