123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- #ifndef _NICE_GPLIKELIHOODAPPROXINCLUDE
- #define _NICE_GPLIKELIHOODAPPROXINCLUDE
- #include <map>
- #include <core/algebra/EigValues.h>
- #include <core/algebra/IterativeLinearSolver.h>
- #include <core/basics/Config.h>
- #include <core/optimization/blackbox/CostFunction.h>
- #include <core/vector/VectorT.h>
- #include "gp-hik-core/FastMinKernel.h"
- #include "gp-hik-core/ImplicitKernelMatrix.h"
- #include "gp-hik-core/parameterizedFunctions/ParameterizedFunction.h"
- namespace NICE {
-
-
- class GPLikelihoodApprox : public OPTIMIZATION::CostFunction
- {
- protected:
-
-
- EigValues *eig;
-
- IterativeLinearSolver *linsolver;
-
- ImplicitKernelMatrix *ikm;
-
- std::map<uint, Vector> binaryLabels;
-
-
- uint nrOfClasses;
-
-
- int nrOfEigenvaluesToConsider;
-
-
- void calculateLikelihood ( double _mypara,
- const FeatureMatrix & _f,
- const std::map< uint, NICE::Vector > & _yset,
- double _noise,
- double _lambdaMax );
-
- std::map<uint, NICE::Vector> * initialAlphaGuess;
-
-
- std::map<uint, Vector> min_alphas;
-
- double min_nlikelihood;
-
- Vector min_parameter;
-
- std::map<unsigned long, double> alreadyVisited;
-
- double parameterLowerBound;
-
- double parameterUpperBound;
-
- bool verifyApproximation;
-
-
- bool verbose;
-
- bool debug;
-
- public:
-
-
- GPLikelihoodApprox( const std::map<uint, Vector> & _binaryLabels,
- ImplicitKernelMatrix *_ikm,
- IterativeLinearSolver *_linsolver,
- EigValues *_eig,
- bool _verifyApproximation = false,
- int _nrOfEigenvaluesToConsider = 1
- );
-
-
- virtual ~GPLikelihoodApprox();
-
-
-
-
-
- void computeAlphaDirect(const OPTIMIZATION::matrix_type & _x,
- const NICE::Vector & _eigenValues
- );
-
-
- virtual double evaluate(const OPTIMIZATION::matrix_type & x);
-
-
-
- const NICE::Vector & getBestParameters () const { return min_parameter; };
- const std::map<uint, Vector> & getBestAlphas () const;
-
- void setParameterLowerBound(const double & _parameterLowerBound);
- void setParameterUpperBound(const double & _parameterUpperBound);
-
- void setInitialAlphaGuess(std::map<uint, NICE::Vector> * _initialAlphaGuess);
- void setBinaryLabels(const std::map<uint, Vector> & _binaryLabels);
-
- void setVerbose( const bool & _verbose );
- void setDebug( const bool & _debug );
-
- bool getVerbose ( ) { return verbose; } ;
- bool getDebug ( ) { return debug; } ;
- };
- }
- #endif
|