STAPLE on Multi-class matrix
staple_multi_mat(
x,
sens_init = 0.99999,
spec_init = 0.99999,
max_iter = 10000,
tol = .Machine$double.eps,
prior = "mean",
verbose = TRUE,
trace = 25,
ties.method = c("first", "random", "last"),
drop_all_same = FALSE
)a nxr matrix where there are n raters and r elements rated
Initialize matrix for sensitivity (p)
Initialize matrix for specificity (q)
Maximum number of iterations to run
Tolerance for convergence
Either "mean" or a matrix of prior probabilities,
print diagnostic messages
Number for modulus to print out verbose iterations
Method passed to max.col
for hard segmentation
drop all records where they are all the same. DO NOT use in practice, only for validation of past results
List of matrix output sensitivities, specificities, and matrix of probabilities
rm(list = ls())
x = matrix(rbinom(5000, size = 5, prob = 0.5), ncol = 1000)
sens_init = 0.99999
spec_init = 0.99999
max_iter = 10000
tol = .Machine$double.eps
prior = "mean"
verbose = TRUE
trace = 25
ties.method = "first"
res = staple_multi_mat(x)
#> There are 6 levels present
#> Making multiple, matrices. Hot-one encode
#> iter: 25, diff: 5.69431779326446e-06
#> iter: 50, diff: 1.11233938726585e-09
#> iter: 75, diff: 2.41306974402278e-13
#> Convergence!
xx = rbind(colMeans(x >= 2) > 0.5, colMeans(x >= 2) >= 0.5)
res = staple_multi_mat(xx, prior = rep(0.5, 1000))
#> There are 2 levels present
#> iter: 1, diff: 9.99998203143893e-06
#> Convergence!
res_bin = staple_bin_mat(xx, prior = rep(0.5, 1000))
#> iter: 1, diff: 9.99998203143893e-06
#> Convergence!
testthat::expect_equal(res$sensitivity[,"1"], res_bin$sensitivity)