netmap.grn.inferrence.inferrence¶
- netmap.grn.inferrence.inferrence(models, data_train_full_tensor, gene_names, xai_method='GradientShap', background_type='zeros', backing_file='grn_adata.h5', return_in_memory=False)[source]¶
Compute the full GRN for all target genes using an autoencoder ensemble.
For each gene acting as an attribution target, attribution scores are computed across all models in the ensemble, aggregated by mean, and either written as a Parquet shard or collected in memory. The resulting AnnData object has cells as observations and directed edges (SourceGene_TargetGene) as variables.
When
backing_fileis notNone, one Parquet file per target gene is written to<dirname(backing_file)>/grn/<gene>.parquetandgrn_adata.Xis a zero-shape placeholder. Useretrieve_top_edges()fromnetmap.utils.data_utilsto load attribution values on demand.- Parameters:
models (list) – List of trained autoencoder model instances.
data_train_full_tensor (torch.Tensor) – Input expression data on CUDA.
gene_names (numpy.ndarray) – Gene name array; order must match tensor columns.
xai_method (str) – XAI method —
'GradientShap'(default),'GuidedBackprop', or'Deconvolution'.background_type (str) – Background for SHAP-like attributions. Defaults to
'zeros'.backing_file (str or None) – Path prefix for output. Parquet shards are written to
<dirname(backing_file)>/grn/<gene>.parquet. Set toNoneto keep the full matrix in memory (high RAM usage).return_in_memory (bool) – If
backing_fileis set and this isTrue, load the HDF5 file back into memory before returning. Defaults toFalse.
- Returns:
- GRN object with cells as obs and edges as var;
Xis an empty placeholder when backed by Parquet.
- GRN object with cells as obs and edges as var;
- Return type: