This function calculates the accuracy of predicted cell types by comparing the predicted labels to the true labels. It allows for the exclusion of certain cell types from the reference when calculating accuracy.

acc(y.predict, y.truth, cts_notin_reference = NULL)

Arguments

y.predict

A character vector representing the predicted cell type labels.

y.truth

A character vector representing the true cell type labels.

cts_notin_reference

A character vector specifying the cell types that should be excluded from the accuracy calculation. If NULL, all cell types are included. Default is NULL.

Value

A numeric value representing the accuracy, i.e., the proportion of correctly predicted labels among the considered cell types.

Details

The function compares the predicted labels (`y.predict`) to the true labels (`y.truth`) and calculates the proportion of correct predictions. If `cts_notin_reference` is provided, cell types in this vector are excluded from the accuracy calculation.

Examples

# Example usage:
y.predict <- c("A", "B", "A", "C", "A", "B")
y.truth <- c("A", "B", "C", "C", "A", "A")
acc_value <- acc(y.predict, y.truth)
print(acc_value)
#> [1] 0.6666667