def __initialize_explainer(self, automl_explainer_setup_obj):
     return MimicWrapper(
         self.__ws,
         automl_explainer_setup_obj.automl_estimator,
         explainable_model=automl_explainer_setup_obj.surrogate_model,
         init_dataset=automl_explainer_setup_obj.X_transform,
         run=self.__run,
         features=automl_explainer_setup_obj.engineered_feature_names,
         feature_maps=[automl_explainer_setup_obj.feature_map],
         classes=automl_explainer_setup_obj.classes,
         explainer_kwargs=automl_explainer_setup_obj.surrogate_model_params)
Exemple #2
0
# Drop the lablled column to get the testing set.
X_test = test_dataset.drop_columns(columns=['<<target_column_name>>'])

# Setup the class for explaining the AtuoML models
automl_explainer_setup_obj = automl_setup_model_explanations(fitted_model,
                                                             '<<task>>',
                                                             X=X_train,
                                                             X_test=X_test,
                                                             y=y_train)

# Initialize the Mimic Explainer
explainer = MimicWrapper(
    ws,
    automl_explainer_setup_obj.automl_estimator,
    LGBMExplainableModel,
    init_dataset=automl_explainer_setup_obj.X_transform,
    run=automl_run,
    features=automl_explainer_setup_obj.engineered_feature_names,
    feature_maps=[automl_explainer_setup_obj.feature_map],
    classes=automl_explainer_setup_obj.classes)

# Compute the engineered explanations
engineered_explanations = explainer.explain(
    ['local', 'global'],
    tag='engineered explanations',
    eval_dataset=automl_explainer_setup_obj.X_test_transform)

# Compute the raw explanations
raw_explanations = explainer.explain(
    ['local', 'global'],
    get_raw=True,