match_evaluate_multiple: match_evaluate_multiple

Description Usage Arguments Value Examples

View source: R/scrna_evaluationFunctions.R

Description

Function to match cluster labels with 'true' clusters using the Hungarian algorithm, and return precision, recall, and F1 score. Written by Lukas Weber in August 2016 as part of his cytometry clustering comparison, with just slight modifications on initial handling of input arguments.

Usage

1
match_evaluate_multiple(clus_algorithm, clus_truth = NULL)

Arguments

clus_algorithm

cluster labels from algorithm

clus_truth

true cluster labels. If NULL, will attempt to read them from the names of 'clus_algorithm' (expecting the format 'clusterName.cellName')

Value

A list.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# random data
dat <- data.frame( 
 cluster=rep(LETTERS[1:3], each=10),
 x=c(rnorm(20, 0), rnorm(10, 1)),
 y=c(rnorm(10, 1), rnorm(20, 0))
)
# clustering
dat$predicted <- kmeans(dist(dat[,-1]),3)$cluster
# evaluation
match_evaluate_multiple(dat$predicted, dat$cluster)

pipeComp documentation built on Nov. 8, 2020, 7:35 p.m.