MachineLearningNotebooks icon indicating copy to clipboard operation
MachineLearningNotebooks copied to clipboard

Get features of a trained model with explain_molde in AutoML

Open hoanglam-novobi opened this issue 7 years ago • 1 comments

Hi everyone,

I created a time-series model with AutoML in Azure. From the best_run and fitted_model, I can get the feature name and the importance of each feature with azureml.train.automl.automlexplainer.

Here is the link I follow up the get information from the model (https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/automated-machine-learning/model-explanation/auto-ml-model-explanation.ipynb).

I thought that I can get it from shap_values, expected_values returned from retrieve_model_explanation/explain_model. But it's strange to me.

Is this the right way to get all features used in the trained model (not only the feature name but also the value of each feature)?

hoanglam-novobi avatar May 07 '19 16:05 hoanglam-novobi

You're looking at the correct notebook. The following cell will allow you to retrieve shap_values, expected values:

from azureml.train.automl.automlexplainer import retrieve_model_explanation

shap_values, expected_values, overall_summary, overall_imp, per_class_summary, per_class_imp =
retrieve_model_explanation(best_run)

Aniththa avatar Jul 02 '19 19:07 Aniththa