shap.maskers.Fixed

class shap.maskers.Fixed

This leaves the input unchanged during masking, and is used for things like scoring labels.

Sometimes there are inputs to the model that we do not want to explain, but rather we want to consider them fixed. The primary example of this is when we explain the loss of the model using the labels. These “true” labels are inputs to the function we are explaining, but we don’t want to attribute credit to them, instead we want to consider them fixed and assign all the credit to the model’s input features. This is where the Fixed masker can help, since we can apply it to the label inputs.

__init__()

Methods

__init__()

load(in_file[, instantiate])

This is meant to be overridden by subclasses and called with super.

mask_shapes(x)

The shape of the masks we expect.

save(out_file)

Save the model to the given file stream.

classmethod load(in_file, instantiate=True)

This is meant to be overridden by subclasses and called with super.

We return constructor argument values when not being instantiated. Since there are no constructor arguments for the Serializable class we just return an empty dictionary.

mask_shapes(x)

The shape of the masks we expect.

save(out_file)

Save the model to the given file stream.