igc.bsc.BslShapCorr#

class igc.bsc.BslShapCorr(module, dataset, dtld_kwargs=None, forward_method_name=None, forward_method_kwargs=None, dtype=torch.float32, dtype_cat=torch.int32)[source]#

Bases: BaselineShapley

Baseline Shapley Correlation (BSC).

See the original paper [LelievreC24] for more information.

add_embedding_method(embedding_method_name, embedding_method_kwargs=None, embedding_n_cat=None)[source]#

Add an embedding method to preprocess categorical inputs.

Warning

This effect of this method must not excluded from the forward method defined by forward_method_name at initialization.

Parameters:
  • embedding_method_name (str) – Name of the embedding method of the module.

  • embedding_method_kwargs (dict) – Additional keyword arguments to the embedding method of the module.

  • embedding_n_cat (int) – Number of categorical inputs. If None, this value is inferred from the input data types (torch.int16, torch.int32, torch.int64).

Return type:

self

compute(x_0=None, y_idx=None, n_iter=8, x_0_batch_size=1, x_seed=None, x_0_seed=100, n_x=None, check_error=True)[source]#

Compute Baseline Shapley Correlation (BSC).

Warning

Baseline Shapley (BS) does not support multiple inputs.

Parameters:
  • x_0 (None | int | float | ArrayLike)

  • y_idx (None | int | ArrayLike)

  • n_iter (int)

  • x_0_batch_size (int)

  • x_seed (None | int)

  • x_0_seed (None | int)

  • n_x (None | int)

  • check_error (bool)

Return type:

ArrayLike

error(bsc, y_idx=None, batch_size=None, x_seed=None, n_x=None)[source]#

Compute BSC error.

Parameters:
  • bsc (ArrayLike)

  • y_idx (None | int | ArrayLike)

  • batch_size (int)

  • x_seed (None | int)

  • n_x (None | int)

Return type:

ArrayLike