diff --git a/supervised/utils/shap.py b/supervised/utils/shap.py index cbd2abc1..f5c174b5 100644 --- a/supervised/utils/shap.py +++ b/supervised/utils/shap.py @@ -4,7 +4,15 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd -import shap +shap_pacakge_available = False +try: + # I'm tired of all shap dependency hell + # ugh + import shap + shap_pacakge_available = True +except Exception: + pass + from sklearn.preprocessing import OneHotEncoder from supervised.algorithms.registry import ( @@ -23,6 +31,8 @@ class PlotSHAP: @staticmethod def is_available(algorithm, X_train, y_train, ml_task): + if not shap_pacakge_available: + return False # https://github.com/mljar/mljar-supervised/issues/112 disable for NN # https://github.com/mljar/mljar-supervised/issues/114 disable for CatBoost if algorithm.algorithm_short_name in ["Baseline", "Neural Network", "CatBoost"]: