Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VEBER Philippe
codepi
Commits
663089b7
Commit
663089b7
authored
Jul 11, 2019
by
Philippe Veber
Browse files
moved result table parser to Utils
parent
c930a6f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
29 deletions
+29
-29
lib/convergence_detection.ml
lib/convergence_detection.ml
+1
-29
lib/utils.ml
lib/utils.ml
+28
-0
No files found.
lib/convergence_detection.ml
View file @
663089b7
...
...
@@ -189,36 +189,8 @@ 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
let
labels
,
scores_per_meth
=
Utils
.
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
...
...
lib/utils.ml
View file @
663089b7
...
...
@@ -59,3 +59,31 @@ let%pworkflow recall_precision_curve ~labels ~oracle ~results : Bistro.pdf Bistr
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
()
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
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment