Skip to content

Commit bdd03da

Browse files
committed
adds options to specify hub explainer dump type
previous behaviour was to default to .joblib, can now specify .dill or .pkl instead.
1 parent dfbf9bb commit bdd03da

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

TODO.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
- add get_descriptions_df tests
55
- do multiclass pdp
6-
- add manual add shap values functionality
6+
77
- experiment with dash_draggable: https://github.com/MehdiChelh/dash-draggable
8-
- add ExplainerHub.to_html()
8+
- add set_shap_values tests
9+
- add hub.to_yaml() dashboard dump option, e.g. 'joblib', 'dill' or 'pkl'
10+
- add how to create `ExplainerComponent` to docs (see closed issue)
911
## Bugs:
1012

1113
## Plots:

explainerdashboard/dashboards.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ def convert_db(db, filepath=None):
13281328
return cls(dashboards, **update_kwargs(config, **update_params))
13291329

13301330
def to_yaml(self, filepath:Path=None, dump_explainers=True,
1331-
return_dict=False, integrate_dashboard_yamls=False):
1331+
return_dict=False, integrate_dashboard_yamls=False, pickle_type="joblib"):
13321332
"""Store ExplainerHub to configuration .yaml, store the users to users.json
13331333
and dump the underlying dashboard .yamls and explainers.
13341334
@@ -1347,6 +1347,8 @@ def to_yaml(self, filepath:Path=None, dump_explainers=True,
13471347
separate_dashboard_yamls=True. Defaults to False.
13481348
integrate_dashboard_yamls(bool, optional): Do not generate an individual
13491349
.yaml file for each dashboard, but integrate them in hub.yaml.
1350+
pickle_type ({'joblib', 'dill', 'pkl'}, optional). Format to dump explainers in.
1351+
Defaults to "joblib". Alternatives are "dill" and "pkl".
13501352
13511353
Returns:
13521354
{dict, yaml, None}
@@ -1368,7 +1370,7 @@ def to_yaml(self, filepath:Path=None, dump_explainers=True,
13681370
for dashboard in self.dashboards:
13691371
print(f"Storing {dashboard.name}_dashboard.yaml...")
13701372
dashboard.to_yaml(filepath.parent / (dashboard.name+"_dashboard.yaml"),
1371-
explainerfile=filepath.parent / (dashboard.name+"_explainer.joblib"),
1373+
explainerfile=filepath.parent / (dashboard.name+f"_explainer.{pickle_type}"),
13721374
dump_explainer=dump_explainers)
13731375
hub_config = dict(
13741376
explainerhub=dict(

explainerdashboard/explainer_methods.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def guess_shap(model):
101101

102102
skorch_models = ['skorch.net.NeuralNet',
103103
'skorch.regressor.NeuralNetRegressor',
104-
'skorch.classifier.NeuralNetClassifier']
104+
'skorch.classifier.NeuralNetClassifier',
105+
'skorch.classifier.NeuralNetBinaryClassifier']
105106

106107
for tree_model in tree_models:
107108
if str(type(model)).endswith(tree_model + "'>"):

0 commit comments

Comments
 (0)