Changeset 121


Ignore:
Timestamp:
Jul 21, 2004, 12:00:49 PM (18 years ago)
Author:
Peter
Message:

return 0 if ok otherwise -1

Location:
trunk/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test_kernel.cc

    r57 r121  
    2525
    2626 
    27   cout << "testing the linear kernel" << endl;   
    28   ifstream is("data/nm_data_centralized.txt");
     27  bool ok = true;
     28  ifstream is("data/nm_data_centralized.txt");
    2929  theplu::gslapi::matrix transposed_data(is);
    3030  is.close();
     
    4343    for(u_int j=0;j<diff.rows();j++)
    4444      tmp+=abs(diff(i,j)/kernel_matlab(i,j));
    45   cout << "The mean relative difference is:" << endl; 
    46   cout << tmp/diff.rows()/diff.rows() << endl;
    4745  delete kf;
     46  if (tmp > diff.rows()*diff.rows()/100000)
     47    ok = false;
    4848 
    49   cout << "testing the polynomial kernel of degree 2" << endl;   
    50   is.open("data/nm_kernel2.txt");
     49  is.open("data/nm_kernel2.txt");
    5150  theplu::gslapi::matrix kernel_matlab2(is);
    5251  is.close();
     
    5857    for(u_int j=0;j<diff.rows();j++)
    5958      tmp+=abs(diff(i,j)/kernel_matlab2(i,j));
    60   cout << "The mean relative difference is:" << endl; 
    61   cout << tmp/diff.rows()/diff.rows() << endl;
    62    
    63   return 0;
     59  if (tmp > diff.rows()*diff.rows()/100)
     60    ok = false;
     61
     62  if (ok=true) 
     63    return 0;
     64  return -1;
    6465}
    6566
  • trunk/test/test_roc.cc

    r113 r121  
    2323  for (unsigned int i=0; i<value.size(); i++)
    2424    value(i)=i;
    25   theplu::cpptools::ROC roc(target, value);
    26   double area = roc.score();
     25  theplu::cpptools::ROC roc;
     26  double area = roc.score(target, value);
    2727  if (area!=1.0){
    2828    cerr << "test_roc: area should be 1.0" << endl;
     
    4343 
    4444  if (ok)
    45     cout << "Ok." << endl;
    46 
    47   return 0;
     45    return 0;
     46  return -1;
    4847}
Note: See TracChangeset for help on using the changeset viewer.