iVAE.utils.fetch_score

iVAE.utils.fetch_score(adata, latent, label_true, label_mode='KMeans', batch=False)[source]

Compute comprehensive evaluation metrics for latent representations.

This function evaluates the quality of latent representations by computing clustering metrics, graph connectivity, and batch integration metrics.

Parameters:
  • adata (anndata.AnnData) – Annotated data matrix (will be modified in place to add latent embeddings).

  • latent (numpy.ndarray) – Latent representations of shape (n_cells, latent_dim).

  • label_true (array-like) – True cluster labels for cells.

  • label_mode (str, optional) – Method for assigning labels from latent space: - ‘KMeans’: Apply K-means clustering (default) - ‘Max’: Use argmax of latent dimensions - ‘Min’: Use argmin of latent dimensions

  • batch (bool, optional) – If True, compute batch integration metrics (requires ‘batch’ in adata.obs). Default is False.

Returns:

If batch=False: (NMI, ARI, ASW, C_H, D_B, G_C, clisi) If batch=True: (NMI, ARI, ASW, C_H, D_B, G_C, clisi, ilisi, bASW) where: - NMI: Normalized Mutual Information - ARI: Adjusted Rand Index - ASW: Average Silhouette Width - C_H: Calinski-Harabasz score - D_B: Davies-Bouldin score - G_C: Graph connectivity - clisi: Cell-type Local Inverse Simpson’s Index - ilisi: Batch Local Inverse Simpson’s Index (batch integration) - bASW: Batch Average Silhouette Width (batch integration)

Return type:

tuple