|
@@ -295,7 +295,7 @@ void inline trainGPSRMean(NICE::Vector & GPMeanRightPart, const double & noise,
|
|
|
for (int run = 0; run < runsPerClassToAverageTraining; run++)
|
|
|
{
|
|
|
NICE::Matrix innerMatrix;
|
|
|
- innerMatrix.multiply(Kmn, Kmn, true /* tranpose first matrix*/, false /* transpose second matrix*/);
|
|
|
+ innerMatrix.multiply(Kmn, Kmn, false /* tranpose first matrix*/, true /* transpose second matrix*/);
|
|
|
|
|
|
innerMatrix.addScaledMatrix( noise, Kmm );
|
|
|
|
|
@@ -322,7 +322,7 @@ void inline trainGPSRMean(NICE::Vector & GPMeanRightPart, const double & noise,
|
|
|
}
|
|
|
|
|
|
// GP subset of regressors
|
|
|
-void inline trainGPSRVar(NICE::Matrix choleskyMatrix, const double & noise, const NICE::Matrix & kernelMatrix, const int & nrOfExamplesPerClass, const int & classNumber, const int & runsPerClassToAverageTraining, const int & nrOfRegressors, std::vector<int> & indicesOfChosenExamples )
|
|
|
+void inline trainGPSRVar(NICE::Matrix & choleskyMatrix, const double & noise, const NICE::Matrix & kernelMatrix, const int & nrOfExamplesPerClass, const int & classNumber, const int & runsPerClassToAverageTraining, const int & nrOfRegressors, std::vector<int> & indicesOfChosenExamples )
|
|
|
{
|
|
|
std::vector<int> examplesToChoose;
|
|
|
indicesOfChosenExamples.clear();
|
|
@@ -376,7 +376,7 @@ void inline trainGPSRVar(NICE::Matrix choleskyMatrix, const double & noise, cons
|
|
|
for (int run = 0; run < runsPerClassToAverageTraining; run++)
|
|
|
{
|
|
|
NICE::Matrix innerMatrix;
|
|
|
- innerMatrix.multiply(Kmn, Kmn, true /* tranpose first matrix*/, false /* transpose second matrix*/);
|
|
|
+ innerMatrix.multiply(Kmn, Kmn, false /* tranpose first matrix*/, true /* transpose second matrix*/);
|
|
|
|
|
|
innerMatrix.addScaledMatrix( noise, Kmm );
|
|
|
|
|
@@ -390,7 +390,7 @@ void inline trainGPSRVar(NICE::Matrix choleskyMatrix, const double & noise, cons
|
|
|
}
|
|
|
|
|
|
tTrainPrecise.stop();
|
|
|
- std::cerr << "Precise time used for GPSRMean training class " << classNumber << ": " << tTrainPrecise.getLast()/(double)runsPerClassToAverageTraining << std::endl;
|
|
|
+ std::cerr << "Precise time used for GPSRVar training class " << classNumber << ": " << tTrainPrecise.getLast()/(double)runsPerClassToAverageTraining << std::endl;
|
|
|
}
|
|
|
|
|
|
KCMinimumEnclosingBall *trainSVDD( const double & noise, const NICE::Matrix kernelMatrix, const int & nrOfExamplesPerClass, const int & classNumber, const int & runsPerClassToAverageTraining )
|
|
@@ -535,13 +535,13 @@ void inline evaluateGPSRMean(const NICE::Vector & kernelVector, const NICE::Vec
|
|
|
{
|
|
|
kernelVectorM[i] = kernelVector[indicesOfChosenExamples[i]];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Timer tTestSingle;
|
|
|
tTestSingle.start();
|
|
|
|
|
|
for (int run = 0; run < runsPerClassToAverageTesting; run++)
|
|
|
{
|
|
|
- // \mean = \k_*^T \cdot K^{-1} \cdot y
|
|
|
+ // \mean = \k_*^T \cdot K^{-1} \cdot y
|
|
|
mean = kernelVectorM.scalarProduct ( GPSRMeanRightPart );
|
|
|
}
|
|
|
|
|
@@ -565,7 +565,7 @@ void inline evaluateGPSRVar(const NICE::Vector & kernelVector, const NICE::Matr
|
|
|
for (int i = 0; i < nrOfRegressors; i++)
|
|
|
{
|
|
|
kernelVectorM[i] = kernelVector[indicesOfChosenExamples[i]];
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
Timer tTestSingle;
|
|
|
tTestSingle.start();
|
|
@@ -573,6 +573,7 @@ void inline evaluateGPSRVar(const NICE::Vector & kernelVector, const NICE::Matr
|
|
|
for (int run = 0; run < runsPerClassToAverageTesting; run++)
|
|
|
{
|
|
|
NICE::Vector rightPart (nrOfRegressors,0.0);
|
|
|
+
|
|
|
choleskySolveLargeScale ( choleskyMatrix, kernelVectorM, rightPart );
|
|
|
|
|
|
uncertainty = noise*kernelVectorM.scalarProduct ( rightPart );
|
|
@@ -653,6 +654,7 @@ int main (int argc, char **argv)
|
|
|
// share parameters among methods and classes?
|
|
|
bool shareParameters = conf.gB("main" , "shareParameters", true);
|
|
|
|
|
|
+ //which methods do we want to use?
|
|
|
bool GPMeanApprox = conf.gB( "main", "GPMeanApprox", false);
|
|
|
bool GPVarApprox = conf.gB( "main", "GPVarApprox", false);
|
|
|
bool GPMean = conf.gB( "main", "GPMean", false);
|
|
@@ -661,6 +663,39 @@ int main (int argc, char **argv)
|
|
|
bool GPSRVar = conf.gB( "main", "GPSRVar", false);
|
|
|
bool Parzen = conf.gB( "main", "Parzen", false);
|
|
|
bool SVDD = conf.gB( "main", "SVDD", false);
|
|
|
+
|
|
|
+ if (GPMeanApprox)
|
|
|
+ std::cerr << "GPMeanApprox used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "GPMeanApprox not used" << std::endl;
|
|
|
+ if (GPVarApprox)
|
|
|
+ std::cerr << "GPVarApprox used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "GPVarApprox not used" << std::endl;
|
|
|
+ if (GPMean)
|
|
|
+ std::cerr << "GPMean used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "GPMean not used" << std::endl;
|
|
|
+ if (GPVar)
|
|
|
+ std::cerr << "GPVar used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "GPVar not used" << std::endl;
|
|
|
+ if (GPSRMean)
|
|
|
+ std::cerr << "GPSRMean used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "GPSRMean not used" << std::endl;
|
|
|
+ if (GPSRVar)
|
|
|
+ std::cerr << "GPSRVar used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "GPSRVar not used" << std::endl;
|
|
|
+ if (Parzen)
|
|
|
+ std::cerr << "Parzen used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "Parzen not used" << std::endl;
|
|
|
+ if (SVDD)
|
|
|
+ std::cerr << "SVDD used" << std::endl;
|
|
|
+ else
|
|
|
+ std::cerr << "SVDD not used" << std::endl;
|
|
|
|
|
|
|
|
|
// GP variance approximation
|
|
@@ -1083,7 +1118,8 @@ int main (int argc, char **argv)
|
|
|
OverallPerformanceSVDD += perfvalueSVDD;
|
|
|
|
|
|
// clean up memory used by SVDD
|
|
|
- delete svdd;
|
|
|
+ if (SVDD)
|
|
|
+ delete svdd;
|
|
|
}
|
|
|
|
|
|
OverallPerformanceGPVarApprox /= nrOfClassesToConcidere;
|