predictions = matrix(
c(5L, 7L, 9L, 2L),
nrow = 1
)
actual = matrix(
c(0, 0, 0, 0, 1, 0, 1, 0, 1, 0),
nrow = 1
)
actual = as(actual, "RsparseMatrix")
identical(rsparse::ap_k(predictions, actual), 1)
Run the code above in your browser using DataLab