Changeset 821 for trunk/test
- Timestamp:
- Mar 18, 2007, 5:00:05 PM (16 years ago)
- Location:
- trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/roc_test.cc
r779 r821 55 55 value(i)=i; 56 56 statistics::ROC roc; 57 double area = roc.score(target, value); 57 for (size_t i=0; i<value.size(); ++i){ 58 roc.add(value(i), target.binary(i)); 59 } 60 double area = roc.area(); 58 61 if (area!=0.0){ 59 62 *error << "test_roc: area is " << area << " should be 0.0" … … 63 66 target.set_binary(0,false); 64 67 target.set_binary(1,true); 65 area = roc.score(target, value); 68 roc.reset(); 69 for (size_t i=0; i<value.size(); ++i) 70 roc.add(value(i), target.binary(i)); 71 area = roc.area(); 66 72 if (area!=1.0){ 67 73 *error << "test_roc: area is " << area << " should be 1.0" … … 70 76 } 71 77 72 double p = roc.p_value(); 78 double p = roc.p_value_one_sided(); 79 double p2 = roc.p_value(); 73 80 double p_matlab = 0.00000115; 74 81 if (p/p_matlab > 1.01 | p/p_matlab < 0.99){ 75 82 *error << "get_p_approx: p-value not correct" << std::endl; 83 *error << p << " expected " << p_matlab << std::endl; 76 84 ok = false; 77 85 } 86 if (p2 != 2*p) { 87 ok = false; 88 *error << "Two-sided P-value should equal 2 * one-sided P-value.\n"; 89 } 78 90 roc.minimum_size() = 20; 79 p = roc.p_value(); 91 p = roc.p_value_one_sided(); 92 p2 = roc.p_value(); 80 93 if (p > pow(10, -8.0) | p < pow(10, -9.0)){ 81 94 *error << "get_p_exact: p-value not correct" << std::endl; 82 95 ok = false; 96 } 97 if (p2 != 2*p) { 98 ok = false; 99 *error << "Two-sided P-value should equal 2 * one-sided P-value.\n"; 83 100 } 84 101 -
trunk/test/score_test.cc
r820 r821 60 60 for (size_t i=0; i<value.size(); i++) 61 61 value(i)=i; 62 statistics::AUC auc ;62 statistics::AUC auc(false); 63 63 double area = auc.score(target, value); 64 if (area!= 1.0){65 *error << "test_auc: area is " << area << " should be 1.0"64 if (area!=0.0){ 65 *error << "test_auc: area is " << area << " should be 0.0" 66 66 << std::endl; 67 67 ok = false; … … 85 85 86 86 utility::vector correct_area(3); 87 correct_area(0)= 8.0/9.0;88 correct_area(1)= 6.0/9.0;89 correct_area(2)= 1.0;87 correct_area(0)=1.0/9.0; 88 correct_area(1)=3.0/9.0; 89 correct_area(2)=0.0; 90 90 91 91 const double tol = 0.001;
Note: See TracChangeset
for help on using the changeset viewer.