feedzai / timeshap

TimeSHAP explains Recurrent Neural Network predictions.
Other
162 stars 30 forks source link

Import Error: cannot import name 'Kernel' #48

Open ViniMelloeMuller opened 1 year ago

ViniMelloeMuller commented 1 year ago

Hello, i'm working on a project using timeSHAP (timeshap==1.0.4) and i'm getting ImportError when:

from timeshap.explainer import local_report

It says:

ImportError: cannot import name 'Kernel' from 'shap.explainers._kernel'

My shap version is (shap==0.43.0). Thanks in advance

OverGreenWaters commented 1 year ago

had the same issue. had to downgrade the shap version (e.g. 0.37.0)

kevduc commented 1 year ago

Looks like Kernel got recently renamed to KernelExplainer, https://github.com/shap/shap/commit/ca08229b8bb93ae05311532b7cc84f21ea8a8043#diff-7ac25c0cf4216cbad9d7079e83c9c36fea1de8413f8fc7460d1b32af21d1fbc2R38

I've renamed it in timeshap in these 2 places and it seems to work:

drorhunvural commented 3 months ago

Looks like Kernel got recently renamed to KernelExplainer, shap/shap@ca08229#diff-7ac25c0cf4216cbad9d7079e83c9c36fea1de8413f8fc7460d1b32af21d1fbc2R38

I've renamed it in timeshap in these 2 places and it seems to work:

Same issue.

Even after changing the Kernel name in timeshap_kernel.py to KernelExplainer as suggested, the problem persists. Is there any update or further guidance available?

Corkman99 commented 2 months ago

Maybe the merge was not pushed? The code still has 'Kernel' instead of 'KernelExplainer'