ソースを参照

Merge branch 'master' of dbv.inf-cv.uni-jena.de:nice/nice-vislearning

Sven Sickert 10 年 前
コミット
20284abe78

+ 3 - 3
cbaselib/MultiDataset.cpp

@@ -16,7 +16,6 @@
 #endif
 #endif
 
-
 #include "vislearning/cbaselib/ClassNames.h"
 
 #include "core/basics/StringTools.h"
@@ -192,9 +191,10 @@ MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
       // given config's directory
       if( t_DatasetFilename.isRelative() )
       {
-          dataset = t_ConfigFilename.extractPath().str() + dataset;
+          t_DatasetFilename.set( t_ConfigFilename.extractPath().str() + dataset );
       }
-      std::string sDatasetConfFilename =  dataset + "/dataset.conf";
+      t_DatasetFilename.convertToRealPath();
+      std::string sDatasetConfFilename =  t_DatasetFilename.str() + "/dataset.conf";
       Config dsconf ( sDatasetConfFilename.c_str() );
 
       dirs[*i] = dataset;

+ 7 - 7
classifier/kernelclassifier/LaplaceApproximation.cpp

@@ -6,12 +6,12 @@
 
 */
 #include <iostream>
+#include <cmath>
 
 #include "core/vector/Algorithms.h"
 #include "LaplaceApproximation.h"
 #include "LHCumulativeGauss.h"
 
-using namespace std;
 using namespace NICE;
 using namespace OBJREC;
 
@@ -24,7 +24,7 @@ LaplaceApproximation::LaplaceApproximation()
 	verbose = false;
 }
 
-LaplaceApproximation::LaplaceApproximation( const Config *conf, const string & section )
+LaplaceApproximation::LaplaceApproximation( const Config *conf, const std::string & section )
 {
 	maxiterations = conf->gI(section, "laplace_max_iterations", 40 );
 	minimumDelta = conf->gD(section, "laplace_minimum_delta", 1e-14 );
@@ -110,7 +110,7 @@ void LaplaceApproximation::approximate ( KernelData *kernelData, const Vector &
 
 		// gradient of the objective function is gradientL - a
 		if ( verbose )
-			cerr << "findModeLaplace: gradient norm = " << (gradientL - a).normL2() << endl;
+			std::cerr << "findModeLaplace: gradient norm = " << (gradientL - a).normL2() << std::endl;
 
 		mode = kernelMatrix * a;
 	
@@ -126,8 +126,8 @@ void LaplaceApproximation::approximate ( KernelData *kernelData, const Vector &
 		{
 			if ( verbose ) 
 			{
-				cerr << "findModeLaplace: log likelihood is positive infinity...we cannot optimize any more in this case." << endl;
-				cerr << "findModeLaplace: mode = " << mode << endl;
+				std::cerr << "findModeLaplace: log likelihood is positive infinity...we cannot optimize any more in this case." << std::endl;
+				std::cerr << "findModeLaplace: mode = " << mode << std::endl;
 			}
 			break;
 		}
@@ -145,11 +145,11 @@ void LaplaceApproximation::approximate ( KernelData *kernelData, const Vector &
 		objective += loglikelihood;
 
 		if ( verbose ) 
-			cerr << "findModeLaplace: objective = " << objective << endl;
+			std::cerr << "findModeLaplace: objective = " << objective << std::endl;
 
 		double delta = fabs(oldobjective-objective)/(fabs(objective)+1);
 		if ( verbose )
-			cerr << "findModeLaplace: delta = " << delta << endl;
+			std::cerr << "findModeLaplace: delta = " << delta << std::endl;
 		if ( delta < minimumDelta ) {
 			break;
 		}

+ 5 - 0
features/simplefeatures/progs/progCodebookRandomForest.cpp

@@ -5,6 +5,9 @@
   * @date 10/05/2014
   */
 
+#ifdef NICE_USELIB_MEX
+#ifdef NICE_USELIB_MATIO
+
 #include <string>
 #include <exception>
 #include <iostream>
@@ -400,3 +403,5 @@ int main(int argc, char **argv)
 
     return 0;
 }
+#endif //#ifdef NICE_USELIB_MATIO
+#endif

+ 3 - 3
features/simplefeatures/tests/TestCodebookRandomForest.h

@@ -1,5 +1,5 @@
-#ifndef _TESTVECTORFEATURE_H
-#define _TESTVECTORFEATURE_H
+#ifndef _TESTCODEBOOKRANDOMFOREST_H
+#define _TESTCODEBOOKRANDOMFOREST_H
 
 #include <cppunit/extensions/HelperMacros.h>
 
@@ -23,4 +23,4 @@ class TestCodebookRandomForest : public CppUnit::TestFixture {
     void testCodebookRandomForest();
 };
 
-#endif // _TESTVECTORFEATURE_H
+#endif // _TESTCODEBOOKRANDOMFOREST_H

+ 5 - 0
math/pdf/PDFGaussian.h

@@ -31,8 +31,13 @@ class PDFGaussian : public PDF
 	/** empty constructor */
 	PDFGaussian ( int dimension );
 
+#if __cplusplus >= 201103L
+	static constexpr double logdetEPS = 0.0;
+	static constexpr double regEPS = 1e-7;
+#else
 	static const double logdetEPS = 0.0;
 	static const double regEPS = 1e-7;
+#endif
 	static NICE::Matrix RobustInverse ( const NICE::Matrix & M, double & logdet );
 
     public:

+ 6 - 7
regression/npregression/RegKNN.cpp

@@ -18,7 +18,6 @@
 
 using namespace OBJREC;
 
-using namespace std;
 using namespace NICE;
 
 
@@ -67,7 +66,7 @@ void RegKNN::teach ( const NICE::Vector & x, const double & y )
     if ( isnan(x[i]) ) 
     {
         fprintf (stderr, "There is a NAN value within this vector: x[%d] = %f\n", (int)i, x[i]);
-        cerr << x << endl;
+        std::cerr << x << std::endl;
         exit(-1);
     }
 
@@ -96,8 +95,8 @@ double RegKNN::predict ( const NICE::Vector & x )
     if ( isnan(distance) )
     {
       fprintf (stderr, "RegKNN::predict: NAN value found !!\n");
-      cerr << x << endl;
-      cerr << dataSet[i] << endl;
+      std::cerr << x << std::endl;
+      std::cerr << dataSet[i] << std::endl;
     }
 // #pragma omp critical      
     distances[i] = distance;     
@@ -110,13 +109,13 @@ double RegKNN::predict ( const NICE::Vector & x )
     
   if ( dataSet.size() < K )
   {
-    cerr << K << endl;
+    std::cerr << K << std::endl;
     K = dataSet.size();
-    cerr<<"RegKNN: Not enough datapoints! Setting K to: "<< K <<endl;
+    std::cerr<<"RegKNN: Not enough datapoints! Setting K to: "<< K << std::endl;
   }
 
   if ( distances[ind[0]] == 0.0 ) {
-    cerr<<"RegKNN: Warning: datapoint was already seen during training... using its label as prediction."<<endl;
+    std::cerr<<"RegKNN: Warning: datapoint was already seen during training... using its label as prediction."<< std::endl;
     return labelSet[ind[0]];  
   }
 

+ 1 - 2
regression/splineregression/CRSplineReg.cpp

@@ -18,7 +18,6 @@
 
 using namespace OBJREC;
 
-using namespace std;
 using namespace NICE;
 
 CRSplineReg::CRSplineReg (  const NICE::Config *_conf )
@@ -69,7 +68,7 @@ void CRSplineReg::teach ( const NICE::Vector & x, const double & y )
       if ( isnan(x[i]) ) 
       {
           fprintf (stderr, "There is a NAN value in within this vector: x[%d] = %f\n", (int)i, x[i]);
-          cerr << x << endl;
+          std::cerr << x << std::endl;
           exit(-1);
       }