Commit b161a3da authored by Philippe Veber's avatar Philippe Veber
Browse files

Result_table: added interface, optional oracle

parent 3e4064ad
......@@ -193,7 +193,8 @@ let recall_precision_curve table =
let%workflow recall_precision_auc_table table =
let module RT = Reviewphiltrans_toolbox.Result_table in
let { RT.labels ; scores_per_meth } = RT.of_file [%path table] in
let { RT.oracle ; scores_per_meth } = RT.of_file [%path table] in
let labels = Option.value_exn oracle in
Array.map scores_per_meth ~f:(fun (meth, scores) ->
let _, auc = Biocaml_unix.Bin_pred.recall_precision_curve ~labels ~scores in
meth, auc
......
open Core_kernel
type t = {
labels : bool array ;
oracle : bool array option ;
scores_per_meth : (string * float array) array ;
}
let of_file fn =
let module D = Owl.Dataframe in
let df = D.of_csv fn in
let labels =
D.get_col_by_name df "Oracle"
|> D.unpack_int_series
|> Array.map ~f:(function
| 0 -> false
| 1 -> true
| _ -> assert false
)
let oracle =
try
D.get_col_by_name df "Oracle"
|> D.unpack_int_series
|> Array.map ~f:(function
| 0 -> false
| 1 -> true
| _ -> failwith "Unexpected element in oracle column"
)
|> Option.some
with Caml.Not_found -> None
in
let scores meth =
match D.get_col_by_name df meth with
......@@ -33,4 +36,4 @@ let of_file fn =
Option.map (scores m) ~f:(fun c -> m, c)
)
in
{ labels ; scores_per_meth }
{ oracle ; scores_per_meth }
(** Format that is expected for the output of a detection method *)
type t = {
oracle : bool array option ;
scores_per_meth : (string * float array) array ;
}
val of_file : string -> t
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment