let confusion_matrix ~scores ~labels ~threshold =
if Array.length scores <> Array.length labels
then
invalid_argf
"Biocaml_bin_pred.confusion_matrix: scores and labels have different lengths (%d and %d)"
(Array.length scores) (Array.length labels) () ;
Array.fold2_exn scores labels ~init:zero ~f:(fun accu score label -> update accu ~threshold ~score ~label)