|
@@ -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;
|
|
|
}
|