igc.Gradients#
- class igc.Gradients(module, dataset, dtld_kwargs=None, forward_method_name=None, forward_method_kwargs=None, dtype=torch.float32, dtype_cat=torch.int32)[source]#
Bases:
AbstractAttributionMethod
Gradients.
- 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