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

Convergence_detection: average precision table calculation

parent 9693092b
......@@ -187,6 +187,41 @@ let recall_precision_curve table =
] ;
]
let result_table_parser 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
)
in
let scores meth =
match D.get_col_by_name df meth with
| Float_Series xs -> Some xs
| Int_Series xs -> Some (Array.map xs ~f:Float.of_int)
| String_Series _ -> None (* has NA *)
| _ -> assert false
in
let methods =
D.get_heads df
|> Array.filter ~f:(fun m -> m <> "Oracle" && m <> "Sites")
in
labels,
Array.filter_map methods ~f:(fun m ->
Option.map (scores m) ~f:(fun c -> m, c)
)
let%workflow recall_precision_auc_table table =
let labels, scores_per_meth = result_table_parser [%path table] in
Array.map scores_per_meth ~f:(fun (meth, scores) ->
let _, auc = Biocaml_unix.Bin_pred.recall_precision_curve ~labels ~scores in
meth, auc
)
let%pworkflow oracle ~n_h0 ~n_ha =
let n_h0 = [%param n_h0] in
let n_ha = [%param n_ha] in
......
......@@ -70,3 +70,7 @@ val oracle :
n_h0:int ->
n_ha:int ->
text_file pworkflow
val recall_precision_auc_table :
text_file pworkflow ->
(string * float) array workflow
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