Changeset 76
- Timestamp:
- May 4, 2004, 11:52:46 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/test_roc.cc
r70 r76 16 16 17 17 { 18 const double x_tmp = 1.0;19 const double sigma_tmp = 1.0;20 double p_tmp = gsl_cdf_gaussian_Q(x_tmp, sigma_tmp);21 18 bool ok = true; 22 19 theplu::gslapi::vector value(31); 23 20 theplu::gslapi::vector target(31,1); 24 21 for (unsigned int i=0; i<16; i++) 25 target( 2*i) = -1;22 target(i) = -1; 26 23 for (unsigned int i=0; i<value.size(); i++) 27 24 value(i)=i; 28 25 theplu::cpptools::ROC roc(target, value); 29 26 double area = roc.area(); 30 if (area!= 0.5){31 cerr << "test_roc: area should be 0.5" << endl;27 if (area!=1.0){ 28 cerr << "test_roc: area should be 1.0" << endl; 32 29 ok = false; 33 30 } 34 31 double p = roc.get_p(area); 35 if (p<0.5 | p>0.51){ 36 cerr << "test_roc: p-value not correct" << endl; 32 double p_matlab = 0.00000105; 33 if (p/p_matlab > 1.01 | p/p_matlab < 0.99){ 34 cerr << "get_p_approx: p-value not correct" << endl; 37 35 ok = false; 38 36 } 39 // target.set_all(1); 40 // for (unsigned int i=0; i<16; i++) 41 // target(i) = -1; 42 // roc = theplu::cpptools::ROC(target, value); 43 37 roc.minimum_size(20); 38 p = roc.get_p(area); 39 if (p > pow(10, -8.0) | p < pow(10, -9.0)){ 40 cerr << "get_p_exact: p-value not correct" << endl; 41 ok = false; 42 } 44 43 45 44 if (ok)
Note: See TracChangeset
for help on using the changeset viewer.