dianna-ai / dianna

Deep Insight And Neural Network Analysis
https://dianna.readthedocs.io
Apache License 2.0
48 stars 13 forks source link

setting kwrags `silent` for tqdm progress bar in kernelshap #803

Closed SarahAlidoost closed 3 months ago

SarahAlidoost commented 5 months ago

The method kernelshap generates a tqdm progress bar, see here. It is useful to be able to hide the progress bar if explainer should be run several times. The original method has a kwargs silent to hide tqdm progress bar, see here. However, it is not possible to pass this argument through dianna because of the get_kwargs_applicable_to_function (in this function args is only inspected. The args attribute contains a list of positional arguments and keyword arguments, but it does not include **kwargs-style arguments.).

To address the issue, we can add silent: bool = False, to __init__ function of KERNELSHAPTabular and pass it to self.explainer.shap_values as self.explainer.shap_values(input_tabular, silent=self.silent, **explain_instance_kwargs)