Changeset 1076 for trunk/test


Ignore:
Timestamp:
Feb 12, 2008, 2:51:11 PM (14 years ago)
Author:
Markus Ringnér
Message:

NCC done for ticket:259

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/ncc_test.cc

    r1075 r1076  
    134134  }
    135135
    136  
     136  //////////////////////////////////////////////////////////////////////////
     137  // A test of predictions using weighted training resulting in NaN's
     138  // in centroids and unweighted test data
     139  //////////////////////////////////////////////////////////////////////////
     140  *error << "test of predictions using nan centroids and unweighted test data\n";
     141  utility::matrix weights2(3,4,1.0);
     142  weights2(1,0)=weights2(1,1)=0.0;
     143  classifier::MatrixLookupWeighted mlw2(data1,weights2);
     144  classifier::NCC<statistics::EuclideanDistance> ncc2(mlw2,target1);
     145  ncc2.train();
     146  ncc2.predict(ml1,prediction1); 
     147  result1(0,0)=result1(0,1)=result1(1,2)=result1(1,3)=sqrt(3.0);
     148  result1(1,0)=result1(1,1)=sqrt(11.0);
     149  result1(0,2)=result1(0,3)=sqrt(15.0);
     150  slack = deviation(prediction1,result1);
     151  if (slack > slack_bound || std::isnan(slack)){
     152    *error << "Difference to expected prediction too large\n";
     153    *error << "slack: " << slack << std::endl;
     154    *error << "expected less than " << slack_bound << std::endl;
     155    ok = false;
     156  }
    137157
    138158  //////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.