Browse Source

bug fix in persistent-function of FeatureMatrixT, unit-tests cleaned

Alexander Freytag 9 years ago
parent
commit
05e9a2b950
3 changed files with 19 additions and 14 deletions
  1. 2 2
      FeatureMatrixT.tcc
  2. 9 9
      matlab/plot1dExampleClassification.m
  3. 8 3
      tests/TestGPHIKPersistent.cpp

+ 2 - 2
FeatureMatrixT.tcc

@@ -1003,13 +1003,13 @@ namespace NICE {
           if ( b_restoreVerbose )
             std::cerr << " currently restore section " << tmp << " in FeatureMatrixT" << std::endl;
           
-          if ( tmp.compare("n") == 0 )
+          if ( tmp.compare("ui_n") == 0 )
           {
             _is >> this->ui_n;        
             _is >> tmp; // end of block 
             tmp = this->removeEndTag ( tmp );
           }
-          else if ( tmp.compare("d") == 0 )
+          else if ( tmp.compare("ui_d") == 0 )
           {
             _is >> this->ui_d;        
             _is >> tmp; // end of block 

+ 9 - 9
matlab/plot1dExampleClassification.m

@@ -11,10 +11,10 @@ myLabels = [1; 2; 2];
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% boolean
 %interested in time measurements?
-b_verboseTime                       = true;
+b_verboseTime                       = false;
 
 %interested in outputs?
-b_verbose                           = true;  
+b_verbose                           = false;  
 
 % important for plotting!
 b_uncertaintyPredictionForClassification ...
@@ -26,7 +26,7 @@ b_ils_verbose                       = false;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% integer
 i_nrOfEigenvaluesToConsiderForVarApprox ...
-                                    = 2;
+                                    = 0;
 i_num_bins                          = 100; % default
 i_ils_max_iterations                = 1000; % default
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -45,14 +45,14 @@ d_parameter_upper_bound             = 1.0;
 s_ils_method                        = 'CG'; % default
 
 % options: 'none', 'greedy', 'downhillsimplex'
-s_optimization_method               = 'none';
+s_optimization_method               = 'downhillsimplex';
 
-% options:  'identity', 'abs', 'absexp'
+% options:  'identity', 'exp', 'absexp'
 % with settings above, this equals 'identity'
-s_transform                         = 'absexp'; 
+s_transform                         = 'identity'; 
 
 % options: 'exact', 'approximate_fine', 'approximate_rough', and 'none'
-s_varianceApproximation             = 'exact'; 
+s_varianceApproximation             = 'approximate_fine'; 
 
 % init new GPHIKClassifier object
 myGPHIKClassifier = ...
@@ -81,7 +81,7 @@ myGPHIKClassifier = ...
         );
 
 %% run train method
-myGPHIKClassifier.train( sparse(myData), myLabels );
+myGPHIKClassifier.train( myData, myLabels );
 
 
 %% evaluate model on test data
@@ -95,7 +95,7 @@ scores = zeros(size(myDataTest,1),1);
 uncertainties = zeros(size(myDataTest,1),1);
 for i=1:size(myDataTest,1)
     example = myDataTest(i,:);
-    example = sparse( example );
+
     [ classNoEst, score, uncertainties(i)] = myGPHIKClassifier.classify( example );
     %[ classNoEst, score] = myGPHIKClassifier.classify( example );
     scores(i) = score(1);

+ 8 - 3
tests/TestGPHIKPersistent.cpp

@@ -24,7 +24,7 @@ using namespace std; //C basics
 using namespace NICE;  // nice-core
 
 const bool verboseStartEnd = true;
-const bool verbose = true;
+const bool verbose = false;
 
 
 CPPUNIT_TEST_SUITE_REGISTRATION( TestGPHIKPersistent );
@@ -83,9 +83,14 @@ void TestGPHIKPersistent::testPersistentMethods()
   yBinTrain -= 1;
   yBinTrain *= -1;
   
-  std::cerr << yBinTrain << std::endl;
+  if ( verbose )
+  {
+    std::cerr << yBinTrain << std::endl;
+  
+    std::cerr << "train classifier with artifially disturbed labels" << std::endl;
+    
+  }
   
-  std::cerr << "train classifier with artifially disturbed labels" << std::endl;
   classifier->train ( examplesTrain , yBinTrain);//yMultiTrain );