Repository navigation
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<Microsoft.ML.IPredictionTransformer<object>> transformerchain = (model as Microsoft.ML.Data.TransformerChain<Microsoft.ML.IPredictionTransformer<object>>);
Microsoft.ML.Data.BinaryPredictionTransformer<**Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryModelParameters, Microsoft.ML.Calibrators.PlattCalibrator>**>
lastTransformer = (BinaryPredictionTransformer<CalibratedModelParametersBase<FastTreeBinaryModelParameters, PlattCalibrator>>)transformerchain.LastTransformer;
lastTransformer.Model.SubModel.GetFeatureWeights(ref weights);
float[] weightsValues = weights.DenseValues().ToArray();
Activity