Browse Source

changes in testImageNetBinaryBruteForce.cpp

bodesheim 12 years ago
parent
commit
a569f75daf
1 changed files with 18 additions and 0 deletions
  1. 18 0
      progs/testImageNetBinaryBruteForce.cpp

+ 18 - 0
progs/testImageNetBinaryBruteForce.cpp

@@ -463,9 +463,11 @@ void inline trainGPFITCMean(NICE::Vector & GPMeanRightPart, const double & noise
       CholeskyRobust cr  ( false /* verbose*/, 0.0 /*noiseStep*/, false /* useCuda*/);
       
       NICE::Matrix Luu (nrOfExamplesPerClass, nrOfExamplesPerClass, 0.0);
+      std::cerr << "mean 1) cr.robustChol ( Kuu, Luu )" << std::endl;
       cr.robustChol ( Kuu, Luu );  
       
       NICE::Matrix V (Ku);
+      std::cerr << "mean 2) choleskySolveMatrixLargeScale( Luu, V)" << std::endl;
       choleskySolveMatrixLargeScale( Luu, V);
       
       NICE::Vector dg (diagK);
@@ -492,6 +494,7 @@ void inline trainGPFITCMean(NICE::Vector & GPMeanRightPart, const double & noise
       NICE::Matrix tmpVV (indicesOfChosenExamples.size(), indicesOfChosenExamples.size(), 0.0);
       tmpVV.multiply(V,V,false,true);
       tmpVV.addIdentity(1.0);
+      std::cerr << "mean 3) cr.robustChol ( tmpVV, Lu );" << std::endl;
       cr.robustChol ( tmpVV, Lu );
       
       NICE::Vector r (dg);
@@ -501,12 +504,15 @@ void inline trainGPFITCMean(NICE::Vector & GPMeanRightPart, const double & noise
       }
       
       NICE::Vector be (indicesOfChosenExamples.size(), 0.0);
+      std::cerr << "mean 4) choleskySolveLargeScale (Lu, V*r, be)" << std::endl;
       choleskySolveLargeScale (Lu, V*r, be);
+      std::cerr << "mean 5) choleskySolveLargeScale (Lu.transpose(), be, be)" << std::endl;
       choleskySolveLargeScale (Lu.transpose(), be, be);
         
       GPMeanRightPart.resize(indicesOfChosenExamples.size());
       GPMeanRightPart.set(0.0);
       
+      std::cerr << "mean 6) choleskySolveLargeScale ( Luu.transpose(), be, GPMeanRightPart )" << std::endl;
       choleskySolveLargeScale ( Luu.transpose(), be, GPMeanRightPart );
     }
  
@@ -583,9 +589,11 @@ void inline trainGPFITCVar(NICE::Matrix & choleskyMatrix, const double & noise,
       CholeskyRobust cr  ( false /* verbose*/, 0.0 /*noiseStep*/, false /* useCuda*/);
       
       NICE::Matrix Luu (nrOfExamplesPerClass, nrOfExamplesPerClass, 0.0);
+      std::cerr << "var 1) cr.robustChol ( Kuu, Luu )" << std::endl;
       cr.robustChol ( Kuu, Luu );  
       
       NICE::Matrix V (Ku);
+      std::cerr << "var 2) choleskySolveMatrixLargeScale( Luu, V)" << std::endl;
       choleskySolveMatrixLargeScale( Luu, V);
       
       NICE::Vector dg (diagK);
@@ -612,17 +620,26 @@ void inline trainGPFITCVar(NICE::Matrix & choleskyMatrix, const double & noise,
       NICE::Matrix tmpVV (indicesOfChosenExamples.size(), indicesOfChosenExamples.size(), 0.0);
       tmpVV.multiply(V,V,false,true);
       tmpVV.addIdentity(1.0);
+      std::cerr << "var 3) cr.robustChol ( tmpVV, Lu )" << std::endl;     
       cr.robustChol ( tmpVV, Lu );
       
       NICE::Matrix iKuu (indicesOfChosenExamples.size(), indicesOfChosenExamples.size(), 0.0);
       iKuu.addIdentity(1.0);
+      std::cerr << "var 4) choleskySolveMatrixLargeScale ( Luu.transpose(), iKuu )" << std::endl;     
       choleskySolveMatrixLargeScale ( Luu.transpose(), iKuu );
+      std::cerr << "var 5) choleskySolveMatrixLargeScale ( Luu, iKuu )" << std::endl;     
       choleskySolveMatrixLargeScale ( Luu, iKuu );
       
       NICE::Matrix LuLuu (indicesOfChosenExamples.size(), indicesOfChosenExamples.size(), 0.0);
       LuLuu.multiply(Lu,Luu);
+      
+      choleskyMatrix.resize( indicesOfChosenExamples.size(), indicesOfChosenExamples.size() );
+      choleskyMatrix.set( 0.0 );
       choleskyMatrix.setIdentity();
+      
+      std::cerr << "var 6) choleskySolveMatrixLargeScale ( LuLuu.transpose(), choleskyMatrix)" << std::endl;     
       choleskySolveMatrixLargeScale ( LuLuu.transpose(), choleskyMatrix);
+      std::cerr << "var 7) choleskySolveMatrixLargeScale ( LuLuu, choleskyMatrix)" << std::endl;     
       choleskySolveMatrixLargeScale ( LuLuu, choleskyMatrix);
       
       choleskyMatrix -= iKuu;
@@ -1662,6 +1679,7 @@ int main (int argc, char **argv)
     timeForSingleExamplesParzen/= imageNetTest.getNumPreloadedExamples();
     timeForSingleExamplesSVDD/= imageNetTest.getNumPreloadedExamples();
     
+    std::cerr.precision(10);
     std::cerr << "GPVarApprox -- time used for evaluation single elements of class " << cl << " : " << timeForSingleExamplesGPVarApprox << std::endl;    
     std::cerr << "GPVar -- time used for evaluation single elements of class " << cl << " : " << timeForSingleExamplesGPVar << std::endl;    
     std::cerr << "GPMeanApprox -- time used for evaluation single elements of class " << cl << " : " << timeForSingleExamplesGPMeanApprox << std::endl;