Skip to content

Question to Kernel SHAP weights #2

@mayer79

Description

@mayer79

Fantastic code.

One question regarding ShapleyRegression() in "shapley.py", which I feel is explaining how iterative Kernel SHAP works.

In your paper "Improving KernelSHAP: Practical Shapley Value Estimation via Linear Regression" you are drawing coalition vectors $z$ according to the Kernel Weight distribution.

What I originally have thought:

"Let's draw $z$ such that the count of "1" follows the Kernel Weight distribution."

But when I read your code below (which I think is correct), then my thinking was actually wrong, because the Kernel Weight distribution does not appear at all in your code.

Was my thinking wrong?

   # Weighting kernel (probability of each subset size).
    num_players = game.players
    weights = np.arange(1, num_players)
    weights = 1 / (weights * (num_players - weights))
    weights = weights / np.sum(weights)

    [...]

    num_included = np.random.choice(num_players - 1, size=batch_size,
                                        p=weights) + 1
    for row, num in zip(S, num_included):
        inds = np.random.choice(num_players, size=num, replace=False)
        row[inds] = 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions