Skip to contents

Evaluates the realism (Precision) and coverage/diversity (Recall) of generated single-cell distributions relative to empirical reference data using k-NN hyperspheres.

Usage

calc_generative_precision_recall(
  ref_mat,
  sim_mat,
  cells_as_cols = TRUE,
  k = 5,
  max_cells = 500,
  max_features = 1000
)

Arguments

ref_mat

Matrix of reference cells (cells x features or features x cells).

sim_mat

Matrix of simulated cells (cells x features or features x cells).

cells_as_cols

Logical, whether cells are columns (default TRUE).

k

Number of nearest neighbors to define the local manifold radius (default 5).

max_cells

Maximum number of cells to subsample (default 500).

max_features

Maximum number of features to retain for speed (default 1000).

Value

A list containing Generative Precision, Generative Recall, and Generative F1.

Examples

data <- matrix(stats::rnorm(200), 20, 10)
cl <- factor(rep(c("A", "B"), each = 10))
dist_mat <- stats::dist(data)
calc_generative_precision_recall(data, cl)
#> $generative_precision
#> [1] NA
#> 
#> $generative_recall
#> [1] NA
#> 
#> $generative_f1
#> [1] NA
#>