netmap.grn.inferrence.attribution_one_target¶
- netmap.grn.inferrence.attribution_one_target(target_gene, lrp_model, input_data, xai_type='lrp-like', background_type='zeros')[source]¶
Compute Captum attributions for a single target gene across all models.
Iterates over every explainer in
lrp_modeland calls.attribute()with the appropriate signature depending onxai_type. The background tensor used for SHAP-style attribution is constructed frominput_dataaccording tobackground_type.- Parameters:
target_gene (int) – Index of the target gene in the expression matrix.
lrp_model (list) – List of Captum explainer objects (one per model in zoo).
input_data (torch.Tensor) – Input data tensor on CUDA, shape
(n_cells, n_genes).xai_type (str) –
'lrp-like'or'shap-like'.background_type (str) – Background for SHAP-like methods —
'zeros'(default),'randomize'(shuffle columns), or'data'(use input as its own baseline).
- Returns:
- One attribution matrix per model, each of shape
(n_cells, n_genes).
- Return type: