mantispy.metrics.evaluate_correction#
- mantispy.metrics.evaluate_correction(adata, *, reps=('X_pca',), label_key='Metadata_Perturbation', batch_key='Metadata_Batch', map_key=None, perplexity=30)#
Run every metric for every representation and stack the results.
Every argument after
adatais keyword-only, so a later metric parameter can be added without changing what an existing argument means.- Parameters:
adata (
AnnData) – Object holding the representations inobsm.reps (
Sequence[str] (default:('X_pca',))) – Representations to compare, e.g.("X_pca", "X_pca_harmony").label_key (
str(default:'Metadata_Perturbation')) –obscolumn with the biological grouping.batch_key (
str(default:'Metadata_Batch')) –obscolumn with the nuisance grouping.map_key (
str|None(default:None)) – Name of a table written bymap(), to add its mean mAP as one more row. That table is read rather than recomputed, so the row appears once, under the representation that run scored, and not once per entry ofreps.perplexity (
float(default:30)) – Perplexity for bothlisi()rows. The default needs more than 90 rows, and on a smaller object those two rows are NaN unless a smaller value is passed.
- Return type:
- Returns:
A tidy frame with
metric,representation,key,valueandbetter, the last saying which direction is an improvement for that metric. A metric that is undefined for this object, such as a LISI whose perplexity the row count cannot support or a silhouette over one row per label, is NaN in that frame rather than an error, so one undefined metric still leaves the others readable.- Raises: