dotnet / dotnet/machinelearning
AutoML 2.0: How to get trainer used for best model
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
I am using latest version from [main] per today. At end of the trial, I want to log parameters and trainer used. I also want to get global feature index. My code* for global feature index relies on knowing which trainer is used.
For now, I intend to "hack" it this way. I believe this will be adequate for my need (not yet tested):
var pipelineString = pipeline.ToString(experimentResults.TrialSettings.Parameter);
if(pipelineString.Contains("FastTree")
However, it would be good to have documentation or implementation, if needed, to read the parameters in a structured format. I have not looked at the source, so maybe it just needs a sample or documentation.
*my code for GFI uses this code, and I have different lines for each tree trainer. If there are better ways it would make my life easier...
```
Microsoft.ML.Data.TransformerChain> transformerchain = (model as Microsoft.ML.Data.TransformerChain>);
Microsoft.ML.Data.BinaryPredictionTransformer<**Microsoft.ML.Calibrators.CalibratedModelParametersBase**>
lastTransformer = (BinaryPredictionTransformer>)transformerchain.LastTransformer;
lastTransformer.Model.SubModel.GetFeatureWeights(ref weights);
float[] weightsValues = weights.DenseValues().ToArray();
```
Contributor guide
Assessment
This issue has not been assessed yet.