igc.naive.NaiveCorrelation#

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

Bases: AbstractAttributionMethod

Naive input/output correlation.

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(y_idx=None, batch_size=None, x_seed=None, n_x=None)[source]#

Compute the naive input/output correlation.

Parameters:
  • y_idx (None | int | ArrayLike)

  • batch_size (int | tuple(int))

  • x_seed (None | int)

  • n_x (None | int)

Return type:

ArrayLike | tuple(ArrayLike)