Browse Source

test case bugfix and no sparsity tolerance

Erik Rodner 9 năm trước cách đây
mục cha
commit
5ab4f6647b
3 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 2 1
      GPHIKRawClassifier.cpp
  2. 1 1
      SortedVectorSparse.h
  3. 4 4
      tests/TestGPHIKOnlineLearnable.cpp

+ 2 - 1
GPHIKRawClassifier.cpp

@@ -193,7 +193,8 @@ void GPHIKRawClassifier::classify ( const NICE::SparseVector * _xstar,
         uint nz = this->num_examples - nnz;
 
         if ( nnz == 0 ) continue;
-        if ( fval < this->f_tolerance ) continue;
+        // useful
+        //if ( fval < this->f_tolerance ) continue;
 
         uint position = 0;
 

+ 1 - 1
SortedVectorSparse.h

@@ -61,7 +61,7 @@ template<class T> class SortedVectorSparse : NICE::Persistent{
     */
     SortedVectorSparse() {
       this->ui_n = 0;
-      this->tolerance = ( T ) 10e-10;
+      this->tolerance = ( T ) 0.0;
       this->b_verbose = false;
     }
 

+ 4 - 4
tests/TestGPHIKOnlineLearnable.cpp

@@ -172,7 +172,7 @@ void compareClassifierOutputs ( const NICE::GPHIKClassifier * classifier,
     NICE::SparseVector::const_iterator itScoresScratch = scoresScratch.begin();
     for ( ; itScores != scores.end(); itScores++, itScoresScratch++)
     {
-      if ( fabs( itScores->second - itScores->second ) > 10e-3)
+      if ( fabs( itScores->second - itScoresScratch->second ) > 10e-3)
       {
         std::cerr << " itScores->second: " << itScores->second << " itScores->second: " << itScores->second << std::endl;
         equal = false;
@@ -213,7 +213,7 @@ void compareClassifierOutputsRaw ( const NICE::GPHIKClassifier * classifier,
     NICE::SparseVector::const_iterator itScoresScratch = scoresRaw.begin();
     for ( ; itScores != scores.end(); itScores++, itScoresScratch++)
     {
-      if ( fabs( itScores->second - itScores->second ) > 10e-6)
+      if ( fabs( itScores->second - itScoresScratch->second ) > 10e-6)
       {
         std::cerr << " itScores->second: " << itScores->second << " itScores->second: " << itScores->second << std::endl;
         equal = false;
@@ -233,7 +233,7 @@ void TestGPHIKOnlineLearnable::testOnlineLearningStartEmpty()
   NICE::Config conf;
   
   conf.sB ( "GPHIKClassifier", "eig_verbose", false);
-  conf.sS ( "GPHIKClassifier", "optimization_method", "downhillsimplex");
+  conf.sS ( "GPHIKClassifier", "optimization_method", "none");
   
   std::string s_trainData = conf.gS( "main", "trainData", "toyExampleSmallScaleTrain.data" );
   
@@ -347,7 +347,7 @@ void TestGPHIKOnlineLearnable::testOnlineLearningOCCtoBinary()
   NICE::Config conf;
   
   conf.sB ( "GPHIKClassifier", "eig_verbose", false);
-  conf.sS ( "GPHIKClassifier", "optimization_method", "downhillsimplex");
+  conf.sS ( "GPHIKClassifier", "optimization_method", "none");
   conf.sB ( "GPHIKClassifier", "verbose", true);
   
   std::string s_trainData = conf.gS( "main", "trainData", "toyExampleSmallScaleTrain.data" );