Skip to content

Commit

Permalink
fix: 🐛 fix fasttreeshap for Leshy, try import only if fastshap is chosen
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBury committed Nov 28, 2023
1 parent 02616fa commit 0de6a86
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/arfs/feature_selection/allrelevant.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,12 @@ def fit(self, X, y, sample_weight=None):
Nothing but attributes
"""
try:
from fasttreeshap import TreeExplainer as FastTreeExplainer
except ImportError:
warnings.warn("fasttreeshap is not installed. Fallback to shap.")
self.importance = "shap"
if self.importance == "fastshap":
try:
from fasttreeshap import TreeExplainer as FastTreeExplainer
except ImportError:
warnings.warn("fasttreeshap is not installed. Fallback to shap.")
self.importance = "shap"

if isinstance(X, pd.DataFrame):
self.feature_names_in_ = X.columns.to_numpy()
Expand Down

0 comments on commit 0de6a86

Please sign in to comment.