Compute the batch separation metric

batch_separation(emb, batch)

Arguments

emb

the embedding of the cells where each row is a cell, and each column is a feature (e.g. principal component)

batch

the batch labels of the cells

Value

Cohen's kappa of the the predicted batch labels with the true batch label on the entire dataset (i.e., training accuracy)

Examples

# suppose that iris[["Species"]] are the batch labels batch_separation(emb = iris[,1:2],batch = iris$Species) # lower batch separation present in dim = 1:2
#> [1] 0.73
plot(iris[,1],iris[,2],col = iris[["Species"]])
batch_separation(emb = iris[,3:4],batch = iris$Species) # higher batch separation in dim = 3:4
#> [1] 0.94
plot(iris[,3],iris[,4],col = iris[["Species"]])