NorskRegnesentral / shapr

Explaining the output of machine learning models with more accurately estimated Shapley values
https://norskregnesentral.github.io/shapr/
Other
138 stars 32 forks source link

GroupShapley in python #350

Closed Billwuzl closed 4 months ago

Billwuzl commented 11 months ago

Hi!

Many thanks for this awesome project! I am currently working on a python project that requires me to calculate Shapley values of feature groups. Your project, Shapr, is really helpful to me. However, I noticed that the python wrapper does not include the calculation of Group Shapley

May I know when the version that includes Group Shapley in python will be released?

martinju commented 11 months ago

Hi, thank you for your interest.

I believe it is supposed to work through the group input argument. What kind of error message do you get? I am currently not near a computer.

Billwuzl commented 11 months ago

Thank you for your timely reply.

https://github.com/NorskRegnesentral/shapr/blob/master/python/shaprpy/explain.py#L116

At line 116 of explain.py, it seems to me that no group list is used.

Billwuzl commented 11 months ago

When my input includes group list, the same output is given as if group list is not included.

git-mojo commented 9 months ago

Looks like wrong arguments in in L117 and L119. Shouldn't this be

        group = maybe_null(group),
        n_batches = maybe_null(n_batches),

?

martinju commented 9 months ago

Yes, there is a bug here, and what you write above is correct. Unsure if further edits are needed, though. Unfortunately, I have not yet had time to fix it, but will try to prioritize it soon. Feel free to provide a PR.