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 :
JavaScript
x
2
1
shap.benchmark.metrics.local_accuracy(X, y, model)
2
But am always getting the error :
JavaScript
1
2
1
AttributeError: module 'shap' has no attribute 'benchmark'
2
Advertisement
Answer
Try instead:
JavaScript
1
3
1
from shap.benchmark import metrics
2
metrics.local_accuracy(X, y, model)
3
Why? Inspecting package’s top level __init__.py
you’ll find out the following commented line:
JavaScript
1
2
1
#from . import benchmark
2