I’m trying to test metrics from the shap library https://github.com/slundberg/shap/blob/master/shap/benchmark/metrics.py
I tried calling metrics like this :
shap.benchmark.metrics.local_accuracy(X, y, model)
But am always getting the error :
AttributeError: module 'shap' has no attribute 'benchmark'
Advertisement
Answer
Try instead:
from shap.benchmark import metrics metrics.local_accuracy(X, y, model)
Why? Inspecting package’s top level __init__.py
you’ll find out the following commented line:
#from . import benchmark