|
@@ -16,11 +16,11 @@
|
|
|
|
|
|
//----------
|
|
|
|
|
|
-#include "gp-hik-exp/GPHIKClassifierNICE.h"
|
|
|
+#include "vislearning/classifier/fpclassifier/FPCGPHIK.h"
|
|
|
|
|
|
//----------
|
|
|
|
|
|
-#include "TestGPHIKClassifier.h"
|
|
|
+#include "TestFPCGPHIK.h"
|
|
|
|
|
|
|
|
|
const bool verbose = false;
|
|
@@ -30,19 +30,19 @@ using namespace OBJREC;
|
|
|
using namespace NICE;
|
|
|
using namespace std;
|
|
|
|
|
|
-CPPUNIT_TEST_SUITE_REGISTRATION( TestGPHIKClassifier );
|
|
|
+CPPUNIT_TEST_SUITE_REGISTRATION( TestFPCGPHIK );
|
|
|
|
|
|
-void TestGPHIKClassifier::setUp() {
|
|
|
+void TestFPCGPHIK::setUp() {
|
|
|
}
|
|
|
|
|
|
-void TestGPHIKClassifier::tearDown() {
|
|
|
+void TestFPCGPHIK::tearDown() {
|
|
|
}
|
|
|
|
|
|
-void myClassifierTest( GPHIKClassifierNICE & classifier, const Matrix & mX, const Vector & vY )
|
|
|
+void myClassifierTest( FPCGPHIK & classifier, const Matrix & mX, const Vector & vY )
|
|
|
{
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::myClassifierTest ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::myClassifierTest ===================== " << std::endl;
|
|
|
|
|
|
Examples examples;
|
|
|
|
|
@@ -89,15 +89,15 @@ void myClassifierTest( GPHIKClassifierNICE & classifier, const Matrix & mX, cons
|
|
|
examples.clean();
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::myClassifierTest done ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::myClassifierTest done ===================== " << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
-void myClassifierStoreRestoreTest( GPHIKClassifierNICE & classifier, const Matrix & mX, const Vector & vY )
|
|
|
+void myClassifierStoreRestoreTest( FPCGPHIK & classifier, const Matrix & mX, const Vector & vY )
|
|
|
{
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::myClassifierStoreRestoreTest ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::myClassifierStoreRestoreTest ===================== " << std::endl;
|
|
|
|
|
|
Examples examples;
|
|
|
|
|
@@ -139,7 +139,7 @@ void myClassifierStoreRestoreTest( GPHIKClassifierNICE & classifier, const Matri
|
|
|
std::cerr << "loading ..." << std::endl;
|
|
|
|
|
|
Config confTmp;
|
|
|
- GPHIKClassifierNICE classifierRestored(&confTmp);
|
|
|
+ FPCGPHIK classifierRestored(&confTmp);
|
|
|
|
|
|
std::filebuf fbIn;
|
|
|
fbIn.open (destination.c_str(),ios::in);
|
|
@@ -181,15 +181,15 @@ void myClassifierStoreRestoreTest( GPHIKClassifierNICE & classifier, const Matri
|
|
|
examples.clean();
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::myClassifierStoreRestoreTest done ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::myClassifierStoreRestoreTest done ===================== " << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
-void myClassifierILTest( GPHIKClassifierNICE & classifierRetrain, GPHIKClassifierNICE & classifierIL, const Matrix & mX, const Vector & vY )
|
|
|
+void myClassifierILTest( FPCGPHIK & classifierRetrain, FPCGPHIK & classifierIL, const Matrix & mX, const Vector & vY )
|
|
|
{
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::myClassifierILTest ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::myClassifierILTest ===================== " << std::endl;
|
|
|
|
|
|
Examples examples;
|
|
|
|
|
@@ -312,24 +312,24 @@ void myClassifierILTest( GPHIKClassifierNICE & classifierRetrain, GPHIKClassifie
|
|
|
examples.clean();
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::myClassifierILTest done ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::myClassifierILTest done ===================== " << std::endl;
|
|
|
}
|
|
|
|
|
|
-void TestGPHIKClassifier::testGPHIKClassifier()
|
|
|
+void TestFPCGPHIK::testFPCGPHIK()
|
|
|
{
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::testGPHIKClassifier ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::testFPCGPHIK ===================== " << std::endl;
|
|
|
|
|
|
Config conf;
|
|
|
- conf.sD( "GPHIKClassifier", "noise", 0.01 );
|
|
|
- conf.sD( "GPHIKClassifier", "parameter_lower_bound", 0.5 );
|
|
|
- conf.sD( "GPHIKClassifier", "parameter_upper_bound", 3.5 );
|
|
|
- conf.sI( "GPHIKClassifier", "uncertaintyPrediction", 1);
|
|
|
-// conf.sS( "GPHIKClassifier", "optimization_method", "none");
|
|
|
- conf.sS( "GPHIKClassifier", "optimization_method", "downhillsimplex");
|
|
|
- conf.sB( "GPHIKClassifier", "uncertaintyPredictionForClassification", true);
|
|
|
+ conf.sD( "FPCGPHIK", "noise", 0.01 );
|
|
|
+ conf.sD( "FPCGPHIK", "parameter_lower_bound", 0.5 );
|
|
|
+ conf.sD( "FPCGPHIK", "parameter_upper_bound", 3.5 );
|
|
|
+ conf.sI( "FPCGPHIK", "uncertaintyPrediction", 1);
|
|
|
+// conf.sS( "FPCGPHIK", "optimization_method", "none");
|
|
|
+ conf.sS( "FPCGPHIK", "optimization_method", "downhillsimplex");
|
|
|
+ conf.sB( "FPCGPHIK", "uncertaintyPredictionForClassification", true);
|
|
|
|
|
|
- GPHIKClassifierNICE * classifier = new GPHIKClassifierNICE ( &conf );
|
|
|
+ FPCGPHIK * classifier = new FPCGPHIK ( &conf );
|
|
|
|
|
|
Matrix mX;
|
|
|
Vector vY;
|
|
@@ -366,8 +366,8 @@ void TestGPHIKClassifier::testGPHIKClassifier()
|
|
|
if (classifier != NULL)
|
|
|
delete classifier;
|
|
|
|
|
|
- classifier = new GPHIKClassifierNICE ( &conf );
|
|
|
- GPHIKClassifierNICE * classifierBatch = new GPHIKClassifierNICE ( &conf );
|
|
|
+ classifier = new FPCGPHIK ( &conf );
|
|
|
+ FPCGPHIK * classifierBatch = new FPCGPHIK ( &conf );
|
|
|
|
|
|
myClassifierILTest( *classifierBatch, *classifier, mX, vY );
|
|
|
|
|
@@ -376,8 +376,8 @@ void TestGPHIKClassifier::testGPHIKClassifier()
|
|
|
if (classifierBatch != NULL)
|
|
|
delete classifierBatch;
|
|
|
|
|
|
- classifier = new GPHIKClassifierNICE ( &conf );
|
|
|
- classifierBatch = new GPHIKClassifierNICE ( &conf );
|
|
|
+ classifier = new FPCGPHIK ( &conf );
|
|
|
+ classifierBatch = new FPCGPHIK ( &conf );
|
|
|
|
|
|
if ( verbose )
|
|
|
std::cerr << "Multi-class classification test " << std::endl;
|
|
@@ -393,8 +393,8 @@ void TestGPHIKClassifier::testGPHIKClassifier()
|
|
|
if (classifierBatch != NULL)
|
|
|
delete classifierBatch;
|
|
|
|
|
|
- classifier = new GPHIKClassifierNICE ( &conf );
|
|
|
- classifierBatch = new GPHIKClassifierNICE ( &conf );
|
|
|
+ classifier = new FPCGPHIK ( &conf, "GPHIKClassifier" /* section */);
|
|
|
+ classifierBatch = new FPCGPHIK ( &conf, "GPHIKClassifier" /* section */ );
|
|
|
|
|
|
myClassifierILTest( *classifierBatch, *classifier, mX, vY_multi );
|
|
|
|
|
@@ -404,14 +404,14 @@ void TestGPHIKClassifier::testGPHIKClassifier()
|
|
|
delete classifierBatch;
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::testGPHIKClassifier done ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::testFPCGPHIK done ===================== " << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
-void TestGPHIKClassifier::testGPHIKVariance()
|
|
|
+void TestFPCGPHIK::testGPHIKVariance()
|
|
|
{
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::testGPHIKVariance ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::testGPHIKVariance ===================== " << std::endl;
|
|
|
|
|
|
double noise (0.01);
|
|
|
|
|
@@ -423,28 +423,28 @@ void TestGPHIKClassifier::testGPHIKVariance()
|
|
|
conf.sB( "GPHIKClassifier", "learn_balanced", true);
|
|
|
conf.sB( "GPHIKClassifier", "uncertaintyPredictionForClassification", true);
|
|
|
|
|
|
- GPHIKClassifierNICE classifier ( &conf );
|
|
|
+ FPCGPHIK classifier ( &conf );
|
|
|
|
|
|
Config confVarApproxQuant(conf);
|
|
|
confVarApproxQuant.sB( "GPHIKClassifier", "use_quantization", true );
|
|
|
- GPHIKClassifierNICE classifierQuant ( &confVarApproxQuant );
|
|
|
+ FPCGPHIK classifierQuant ( &confVarApproxQuant );
|
|
|
|
|
|
Config confVarApproxFine1(conf);
|
|
|
confVarApproxFine1.sS( "GPHIKClassifier", "varianceApproximation", "approximate_fine");
|
|
|
confVarApproxFine1.sI( "GPHIKClassifier", "nrOfEigenvaluesToConsiderForVarApprox", 1);
|
|
|
|
|
|
- GPHIKClassifierNICE classifierVarApproxFine1 ( &confVarApproxFine1 );
|
|
|
+ FPCGPHIK classifierVarApproxFine1 ( &confVarApproxFine1 );
|
|
|
|
|
|
Config confVarApproxFine2(conf);
|
|
|
confVarApproxFine2.sS( "GPHIKClassifier", "varianceApproximation", "approximate_fine");
|
|
|
confVarApproxFine2.sI( "GPHIKClassifier", "nrOfEigenvaluesToConsiderForVarApprox", 2);
|
|
|
|
|
|
- GPHIKClassifierNICE classifierVarApproxFine2 ( &confVarApproxFine2 );
|
|
|
+ FPCGPHIK classifierVarApproxFine2 ( &confVarApproxFine2 );
|
|
|
|
|
|
Config confExact(conf);
|
|
|
confExact.sS( "GPHIKClassifier", "varianceApproximation", "exact");
|
|
|
|
|
|
- GPHIKClassifierNICE classifierVarExact ( &confExact );
|
|
|
+ FPCGPHIK classifierVarExact ( &confExact );
|
|
|
|
|
|
NICE::Matrix mX;
|
|
|
NICE::Vector vY;
|
|
@@ -529,7 +529,7 @@ void TestGPHIKClassifier::testGPHIKVariance()
|
|
|
|
|
|
|
|
|
if (verboseStartEnd)
|
|
|
- std::cerr << "================== TestGPHIKClassifier::testGPHIKVariance done ===================== " << std::endl;
|
|
|
+ std::cerr << "================== TestFPCGPHIK::testGPHIKVariance done ===================== " << std::endl;
|
|
|
|
|
|
}
|
|
|
|