Skip to content

Commit

Permalink
Updated waring to emphasize sampling with replacement.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertSamoilescu committed Jul 1, 2022
1 parent db1c0e6 commit 58ee40d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions alibi/explainers/shap_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,11 +1171,12 @@ def fit(self, # type: ignore[override]
# leave the logic above untouched. This approach has at least two benefits:
# i) minimal refactoring
# ii) return the correct result if a newer version of shap which fixes the issue is used before we
# update our wrapper in alibi (i.e. just ignore the warning)
# update our dependencies in alibi (i.e. just ignore the warning)
if n_samples > TREE_SHAP_BACKGROUND_SUPPORTED_SIZE:
logger.warning('The upstream implementation of interventional TreeShap supports only up to '
logger.warning(f'The upstream implementation of interventional TreeShap supports only up to '
f'{TREE_SHAP_BACKGROUND_SUPPORTED_SIZE} samples in the background dataset. '
'A larger background dataset size will result in erroneous Shap values.')
f'A larger background dataset will be sampled with replacement to '
f'{TREE_SHAP_BACKGROUND_SUPPORTED_SIZE} instances.')

perturbation = 'interventional' if background_data is not None else 'tree_path_dependent'
self.background_data = background_data
Expand Down

0 comments on commit 58ee40d

Please sign in to comment.