From 58ee40d215f3076b34bf5dfb16846f70ab7a0e3a Mon Sep 17 00:00:00 2001 From: RobertSamoilescu Date: Fri, 1 Jul 2022 12:10:23 +0100 Subject: [PATCH] Updated waring to emphasize sampling with replacement. --- alibi/explainers/shap_wrappers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/alibi/explainers/shap_wrappers.py b/alibi/explainers/shap_wrappers.py index 902fb3ca9..ae981c637 100644 --- a/alibi/explainers/shap_wrappers.py +++ b/alibi/explainers/shap_wrappers.py @@ -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