|
@@ -602,7 +602,10 @@ void FMKGPHyperparameterOptimization::initFromConfig ( const Config *_conf,
|
|
|
|
|
|
|
|
|
|
|
|
- this->eig = new EVArnoldi ( _conf->gB ( _confSection, "eig_verbose", false ) , 10 );
|
|
|
+ int eigValueMaxIterations = _conf->gI ( _confSection, "eig_value_max_iterations", 10 );
|
|
|
+ this->eig = new EVArnoldi ( _conf->gB ( _confSection, "eig_verbose", false ) ,
|
|
|
+ eigValueMaxIterations
|
|
|
+ );
|
|
|
|
|
|
this->nrOfEigenvaluesToConsider = std::max ( 1, _conf->gI ( _confSection, "nrOfEigenvaluesToConsider", 1 ) );
|
|
|
|
|
@@ -1352,31 +1355,28 @@ void FMKGPHyperparameterOptimization::computePredictiveVarianceApproximateFine (
|
|
|
|
|
|
std::cerr << "ApproxFine -- time for kernel vector: " << t.getLast() << std::endl;*/
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
NICE::Vector multiplicationResults( this->nrOfEigenvaluesToConsiderForVarApprox-1, 0.0 );
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if ( this->b_debug )
|
|
|
- {
|
|
|
- std::cerr << "FMKGPHyp::VarApproxFine -- nrOfEigenvaluesToConsiderForVarApprox: " << this->nrOfEigenvaluesToConsiderForVarApprox << std::endl;
|
|
|
- std::cerr << "FMKGPHyp::VarApproxFine -- initial multiplicationResults: " << multiplicationResults << std::endl;
|
|
|
- }
|
|
|
+
|
|
|
+ if ( this->b_debug )
|
|
|
+ {
|
|
|
+ std::cerr << "FMKGPHyp::VarApproxFine -- nrOfEigenvaluesToConsiderForVarApprox: " << this->nrOfEigenvaluesToConsiderForVarApprox << std::endl;
|
|
|
+ std::cerr << "FMKGPHyp::VarApproxFine -- initial multiplicationResults: " << multiplicationResults << std::endl;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
NICE::Matrix::const_iterator eigenVecIt = this->eigenMaxVectors.begin();
|
|
|
-
|
|
|
- for ( int tmpJ = 0; tmpJ < this->nrOfEigenvaluesToConsiderForVarApprox-1; tmpJ++)
|
|
|
{
|
|
|
- for ( NICE::Vector::const_iterator kStarIt = kStar.begin(); kStarIt != kStar.end(); kStarIt++,eigenVecIt++)
|
|
|
- {
|
|
|
- multiplicationResults[tmpJ] += (*kStarIt) * (*eigenVecIt);
|
|
|
+ NICE::Vector::iterator multResIt = multiplicationResults.begin();
|
|
|
+ for ( int tmpJ = 0; tmpJ < this->nrOfEigenvaluesToConsiderForVarApprox-1; tmpJ++, multResIt++)
|
|
|
+ {
|
|
|
+ for ( NICE::Vector::const_iterator kStarIt = kStar.begin(); kStarIt != kStar.end(); kStarIt++ ,eigenVecIt++)
|
|
|
+ {
|
|
|
+ (*multResIt) += (*kStarIt) * (*eigenVecIt);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
if ( this->b_debug )
|
|
|
{
|
|
@@ -1391,8 +1391,8 @@ void FMKGPHyperparameterOptimization::computePredictiveVarianceApproximateFine (
|
|
|
|
|
|
while ( cnt < ( this->nrOfEigenvaluesToConsiderForVarApprox - 1 ) )
|
|
|
{
|
|
|
- projectionLength = ( *it );
|
|
|
- currentSecondTerm += ( 1.0 / this->eigenMax[cnt] ) * pow ( projectionLength, 2 );
|
|
|
+ projectionLength = ( *it );
|
|
|
+ currentSecondTerm += ( 1.0 / this->eigenMax[cnt] ) * pow ( projectionLength, 2 );
|
|
|
sumOfProjectionLengths += pow ( projectionLength, 2 );
|
|
|
|
|
|
it++;
|
|
@@ -1406,7 +1406,7 @@ void FMKGPHyperparameterOptimization::computePredictiveVarianceApproximateFine (
|
|
|
|
|
|
if ( ( normKStar - sumOfProjectionLengths ) < 0 )
|
|
|
{
|
|
|
- std::cerr << "Attention: normKStar - sumOfProjectionLengths is smaller than zero -- strange!" << std::endl;
|
|
|
+ std::cerr << "Attention: normKStar: " << normKStar << " - sumOfProjectionLengths: " << sumOfProjectionLengths << " is smaller than zero -- strange!" << std::endl;
|
|
|
}
|
|
|
_predVariance = kSelf - currentSecondTerm;
|
|
|
}
|