nichecompass.benchmarking.compute_benchmarking_metrics

nichecompass.benchmarking.compute_benchmarking_metrics(adata, metrics=['cas', 'mlami', 'clisis', 'gcs', 'cnmi', 'nasw', 'basw', 'blisi', 'kbet', 'pcr'], cell_type_key='cell_type', batch_key=None, spatial_key='spatial', latent_key='nichecompass_latent', pcr_X_pre=None, n_jobs=1, seed=0, mlflow_experiment_id=None)

Compute all specified benchmarking metrics.

Parameters:
  • adata (AnnData) – AnnData object to run the benchmarks for.

  • metrics (list (default: ['cas', 'mlami', 'clisis', 'gcs', 'cnmi', 'nasw', 'basw', 'blisi', 'kbet', 'pcr'])) – List of metrics which will be computed.

  • cell_type_key (str (default: 'cell_type')) – Key under which the cell type annotations are stored in ´adata.obs´.

  • spatial_key (str (default: 'spatial')) – Key under which the spatial coordinates are stored in ´adata.obsm´.

  • latent_key (str (default: 'nichecompass_latent')) – Key under which the latent representation from a model is stored in ´adata.obsm´.

  • pcr_X_pre (Optional[array] (default: None)) – The unintegrated feature space for the computation of the pcr metric. If None, computes PCA on the raw counts stored in ´adata.X´.

  • n_jobs (int (default: 1)) – Number of jobs to use for parallelization of neighbor search.

  • seed (int (default: 0)) – Random seed for reproducibility.

  • mlflow_experiment_id (Optional[str] (default: None)) – ID of the Mlflow experiment used for tracking metrics.

Return type:

dict

Returns:

benchmarking_dict: Dictionary containing the calculated benchmarking metrics.