Esempio n. 1
0
             if (not alg.name.startswith("TPOT") and
                 not alg.name.startswith("AutoSklearn") and
                 not alg.name.startswith("XGBoost")):
                 if alg.type == 'classification':
                     model_explainer = shap.KernelExplainer(model.predict_proba, dataframe_train)
                 if alg.type == 'regression' or alg.type == 'anomaly':
                     model_explainer = shap.KernelExplainer(model.predict, dataframe_train)
             else:
                 print("Model explainer not supported for the selected algorithm!")
     else:
         print("Model explainer not supported on GPU!")
     # -------------------------------------------------------------
     # Check if sampling is enabled for AutoSklearn
     #
     if alg.sampling:
         model.refit(dataframe_train.values.copy(), dataframe_label.values.ravel().copy())
     # -------------------------------------------------------------
     # Get the fitted model from TPOT
     #
     if alg.name == 'TPOT_Regressor' or alg.name == 'TPOT_Classifier':
         model = model.fitted_pipeline_
 else:
     # -------------------------------------------------------------
     # Non-supervised algorithms
     #
     if NVIDIA_RAPIDS_ENABLED:
         model.fit(dataframe_train)
     else:
         model.fit(dataframe_train.values)
         model_explainer = shap.KernelExplainer(model.predict, dataframe_train)
     # if is_labeled_data and alg.automl: