
Assess concordance between true and predicted spatial ecotype labels
Source:R/ComputeMetrics.R
ComputeMetrics.RdComputes an F1-score matrix comparing true spatial ecotype (SE) labels and predicted SE labels (e.g., from cross-validation). The function calculates precision and recall per SE within each sample and returns an averaged F1-score matrix across samples.
Usage
ComputeMetrics(
scmeta,
SE = "SE",
Pred = "cvPred",
CellType = NULL,
Sample = "Sample",
metric = c("F1", "F2", "precision", "recall")[1]
)Arguments
- scmeta
A data.frame containing single-cell metadata.
- SE
Character. Column name in `scmeta` for true SE labels.
- Pred
Character. Column name in `scmeta` for predicted SE labels.
- CellType
Character or NULL. Optional column name for cell type. If provided, SE labels will be concatenated with cell type labels.
- Sample
Character or NULL. Column name for sample identifiers in `scmeta`. If NULL, all cells are treated as coming from a single sample.
- metric
One of 'F1', 'F2', 'precision', or 'recall'.