scviva.model.base.SpatialPredictiveMixin

scviva.model.base.SpatialPredictiveMixin#

class scviva.model.base.SpatialPredictiveMixin[source]#

Shared predictive methods for spatial models with neighbor graphs.

Applied to: SCVIVA, ResolVI.

Provides: - get_neighbor_abundance: cell-type composition of spatial neighborhoods.

Two intentionally different contracts depending on the model:

  • ResolVI (Pyro): uses this mixin default — model-predicted abundance from posterior sampling (PyroSampleMixin.sample_posterior). Honors n_samples / return_mean / weights.

  • SCVIVA (PyTorch): overrides this in its class body to return the observed precomputed niche composition (not a posterior quantity).

  • _get_label_names: shared accessor for cell-type label names from the labels registry (used for DataFrame column labels). Note that a model whose neighbor-composition array is stored in a different column order (e.g. SCVIVA’s observed niche_composition) should keep its own stored columns rather than relabel via this accessor.

Notes

Importance-weighted expression (get_normalized_expression_importance) is not provided here: it requires the Pyro guide and likelihood reweighting, so it lives on ResolVI only. PyTorch models obtain importance weighting via get_normalized_expression(weights="importance") (RNASeqMixin).

__init__()#

Methods

__init__()

get_neighbor_abundance([adata, indices, ...])

Returns the abundance of cell-types within spatial proximity of center cells.