Changeset 76


Ignore:
Timestamp:
May 4, 2004, 11:52:46 AM (19 years ago)
Author:
Peter
Message:

updated the test program

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test_roc.cc

    r70 r76  
    1616
    1717
    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);
    2118  bool ok = true;
    2219  theplu::gslapi::vector value(31);
    2320  theplu::gslapi::vector target(31,1);
    2421  for (unsigned int i=0; i<16; i++)
    25     target(2*i) = -1;
     22    target(i) = -1;
    2623  for (unsigned int i=0; i<value.size(); i++)
    2724    value(i)=i;
    2825  theplu::cpptools::ROC roc(target, value);
    2926  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;
    3229    ok = false;
    3330  }
    3431  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;
    3735    ok = false;
    3836  }
    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  }
    4443 
    4544  if (ok)
Note: See TracChangeset for help on using the changeset viewer.