shap.utils.MaskedModel

class shap.utils.MaskedModel(model, masker, link, linearize_link, *args)

This is a utility class that combines a model, a masker object, and a current input.

The combination of a model, a masker object, and a current input produces a binary set function that can be called to mask out any set of inputs. This class attempts to be smart about only evaluating the model for background samples when the inputs changed (note this requires the masker object to have a .invariants method).

__init__(model, masker, link, linearize_link, *args)

Methods

__init__(model, masker, link, ...)

main_effects([inds, batch_size])

Compute the main effects for this model.

varying_inputs()

Attributes

delta_mask_noop_value

mask_shapes

main_effects(inds=None, batch_size=None)

Compute the main effects for this model.