projects
/
data-tool.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
86128aa
)
--cumul now computes P(X <= x) instead of P(X < x).
master
author
Francois Fleuret
<francois@fleuret.org>
Wed, 15 Jan 2014 07:34:09 +0000
(08:34 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Wed, 15 Jan 2014 07:34:09 +0000
(08:34 +0100)
data-tool.cc
patch
|
blob
|
history
diff --git
a/data-tool.cc
b/data-tool.cc
index
dc868a0
..
9ab7a8c
100644
(file)
--- a/
data-tool.cc
+++ b/
data-tool.cc
@@
-240,7
+240,7
@@
int main(int argc, char **argv) {
}
}
}
}
- Couple
tmp
[nb_samples];
+ Couple
*tmp = new Couple
[nb_samples];
for(int n = 0; n < nb_samples; n++) {
tmp[n].index = n;
tmp[n].value = x[n];
for(int n = 0; n < nb_samples; n++) {
tmp[n].index = n;
tmp[n].value = x[n];
@@
-249,8
+249,9
@@
int main(int argc, char **argv) {
qsort(tmp, nb_samples, sizeof(Couple), compare_couple);
for(int n = 0; n < nb_samples; n++)
qsort(tmp, nb_samples, sizeof(Couple), compare_couple);
for(int n = 0; n < nb_samples; n++)
- cout << tmp[n].value << " " << double(n)/double(nb_samples) << endl;
+ cout << tmp[n].value << " " << double(n
+1
)/double(nb_samples) << endl;
+ delete[] tmp;
delete[] x;
}
delete[] x;
}
@@
-284,7
+285,7
@@
int main(int argc, char **argv) {
}
}
}
}
- Couple
tmp
[nb_samples];
+ Couple
*tmp = new Couple
[nb_samples];
int nb_rn = 0, nb_rp = 0, nb_fp = 0, nb_fn = 0;
bool binary = true;
int nb_rn = 0, nb_rp = 0, nb_fp = 0, nb_fn = 0;
bool binary = true;
@@
-342,7
+343,9
@@
int main(int argc, char **argv) {
}
}
}
}
- delete[] x; delete[] y;
+ delete[] tmp;
+ delete[] x;
+ delete[] y;
}
}
@@
-374,7
+377,7
@@
int main(int argc, char **argv) {
}
}
}
}
- int
nb
[nb_bins];
+ int
*nb = new int
[nb_bins];
for(int n = 0; n < nb_bins; n++) nb[n] = 0;
int nb_total = 0;
for(int n = 0; n < nb_bins; n++) nb[n] = 0;
int nb_total = 0;
@@
-396,6
+399,8
@@
int main(int argc, char **argv) {
cout << xmin + ((xmax - xmin) * n) / double(nb_bins) << " "
<< nb[n] / double(nb_total) << endl;
}
cout << xmin + ((xmax - xmin) * n) / double(nb_bins) << " "
<< nb[n] / double(nb_total) << endl;
}
+
+ delete[] nb;
}
break;
}
break;
@@
-430,7
+435,7
@@
int main(int argc, char **argv) {
}
}
}
}
- Couple
tmp
[nb_samples];
+ Couple
*tmp = new Couple
[nb_samples];
for(int n = 0; n < nb_samples; n++) {
tmp[n].index = n;
tmp[n].value = x[n];
for(int n = 0; n < nb_samples; n++) {
tmp[n].index = n;
tmp[n].value = x[n];
@@
-455,6
+460,7
@@
int main(int argc, char **argv) {
<< " QUANTILE0.9 " << tmp[int(nb_samples * 0.9)].value
<< endl;
<< " QUANTILE0.9 " << tmp[int(nb_samples * 0.9)].value
<< endl;
+ delete[] tmp;
}
break;
}
break;