Changeset 156


Ignore:
Timestamp:
Sep 10, 2004, 3:34:43 PM (17 years ago)
Author:
Peter
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test_roc.cc

    r151 r156  
    6161 
    6262  theplu::gslapi::vector correct_area(3);
    63   correct_area(0)=1.0;
    64   correct_area(1)=0.75;
    65   correct_area(2)=0.50;
     63  correct_area(0)=8.0/9.0;
     64  correct_area(1)=6.0/9.0;
     65  correct_area(2)=1.0;
    6666
     67  const double tol = 0.001;
    6768  for (size_t i=0; i<data.rows(); i++){
    6869    theplu::gslapi::vector vec = data[i];
    6970    area = roc.score(target2,vec);
    70     if (area!=correct_area(i)){
     71    if (area<correct_area(i)-tol || area>correct_area(i)+tol){
    7172      cerr << "test_roc: area is " << area << " should be "
    7273           << correct_area(i) << endl;
     
    7576  }
    7677
     78  theplu::gslapi::vector weight(target2.size(),1);
     79  for (size_t i=0; i<data.rows(); i++){
     80    theplu::gslapi::vector vec = data[i];
     81    area = roc.score(target2, vec, weight);
     82    if (area<correct_area(i)-tol || area>correct_area(i)+tol){
     83      cerr << "test_roc: weighted area is " << area << " should be "
     84           << correct_area(i) << endl;
     85      return -1;
     86    }
     87  }
     88
     89
    7790  if (ok)
    7891    return 0;
Note: See TracChangeset for help on using the changeset viewer.