X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=data-tool.git;a=blobdiff_plain;f=data-tool.cc;h=dc868a01d6ec55f65436a80655a3a647fe4790e9;hp=bcf19b357d09340b28c28556e104d235ee093e8e;hb=86128aa37a694baa6bd2e82fcbf5129c4e7e7277;hpb=3201af50a66f14e327f41549c183871e837556c8 diff --git a/data-tool.cc b/data-tool.cc index bcf19b3..dc868a0 100644 --- a/data-tool.cc +++ b/data-tool.cc @@ -92,6 +92,7 @@ void print_help_and_exit(int e) { << " --help" << endl << " --roc" << endl << " --roc-surface" << endl + << " --error" << endl << " --normalize" << endl << " --histo" << endl << " --cumul" << endl @@ -121,7 +122,7 @@ int main(int argc, char **argv) { int i = 1; - enum { UNKNOWN, ROC, ROC_SURFACE, HISTO, CUMUL, MISC } processing = UNKNOWN; + enum { UNKNOWN, ROC, ROC_SURFACE, ERROR, HISTO, CUMUL, MISC } processing = UNKNOWN; // Parsing the command line arguments //////////////////////////////// @@ -141,6 +142,12 @@ int main(int argc, char **argv) { i++; } + else if(strcmp(argv[i], "--error") == 0) { + check_single_processing(processing == UNKNOWN); + processing = ERROR; + i++; + } + else if(strcmp(argv[i], "--cumul") == 0) { check_single_processing(processing == UNKNOWN); processing = CUMUL; @@ -252,6 +259,7 @@ int main(int argc, char **argv) { case ROC: case ROC_SURFACE: + case ERROR: { int nb_samples = 0, nb_samples_max = 1000; @@ -305,11 +313,11 @@ int main(int argc, char **argv) { if(tmp[n].value < tmp[n+1].value) { cout << double(nb_fp)/double(nb_rn) << " " << 1 - double(nb_fn) / double(nb_rp) << " " - << (tmp[n].value + tmp[n+1].value) << " " + << (tmp[n].value + tmp[n+1].value)/2 << " " << endl; } } - } else { + } else if(processing == ROC_SURFACE) { double surface = 0; double cx = double(nb_fp)/double(nb_rn), cy = 1 - double(nb_fn) / double(nb_rp); for(int n = 0; n < nb_samples - 1; n++) { @@ -322,6 +330,16 @@ int main(int argc, char **argv) { } } cout << surface << endl; + } else { + for(int n = 0; n < nb_samples - 1; n++) { + if(x[tmp[n].index] >= 0) nb_fn++; + else nb_fp--; + if(tmp[n].value < tmp[n+1].value) { + cout << (tmp[n].value + tmp[n+1].value)/2 << " " + << double(nb_fp + nb_fn)/double(nb_rn + nb_rp) << " " + << endl; + } + } } delete[] x; delete[] y;