Commit 1894f40b authored by Philippe Veber's avatar Philippe Veber
Browse files

reimplemented RP curves

parent 792657df
......@@ -185,6 +185,14 @@ let oracle d =
in
Convergence_detection.oracle ~n_h0 ~n_ha
let multinomial_benchmark d =
Utils.rp_curve
~oracle:(oracle d)
~labels:[|"LRT"|]
~results:[
multinomial_asymptotic_lrt d ;
]
let benchmark d =
Convergence_detection.merge_result_tables
~multinomial:(multinomial d)
......
......@@ -30,3 +30,31 @@ let%pworkflow fasta_cappend fa1 fa2 =
)
|> List.map ~f:(fun (d, s) -> sprintf ">%s\n%s" d s)
|> Out_channel.write_lines [%dest]
let%pworkflow rp_curve ~labels ~oracle ~results : Bistro.pdf Bistro.pworkflow =
let n = Array.length labels in
let colors = Array.sub [|"blue";"green";"red";"tan1";"royalblue4";"darkorchid"|] ~pos:0 ~len:n in
let labels = [%param labels] in
let load_results fn =
let open Owl.Dataframe in
match get_col (of_csv ~sep:'\t' fn) 1 with
| Float_Series xs -> xs
| Int_Series xs -> Array.map xs ~f:Float.of_int
| _ -> assert false
in
let oracle =
load_results [%path oracle]
|> Array.map ~f:(( <> ) 0.)
in
let results = List.map ~f:load_results [%eval Bistro.Workflow.eval_paths results] in
let result_curves =
List.map results ~f:(fun scores ->
Biocaml_unix.Bin_pred.rp_curve ~scores ~labels:oracle
|> Array.unzip
)
in
OCamlR_grDevices.pdf [%dest] ;
OCamlR_graphics.plot ~xlab:"Recall" ~ylab:"Precision" ~xlim:(0., 1.) ~ylim:(0., 1.) ~x:[||] ~y:[||] () ;
List.iteri result_curves ~f:(fun i (x, y) -> OCamlR_graphics.lines ~col:colors.(i) ~x ~y ()) ;
OCamlR_graphics.legend ~pch:[|19|] ~col:colors `bottomleft labels ;
OCamlR_grDevices.dev_off ()
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