RegGaussianProcess.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * @file RegGaussianProcess.h
  3. * @author Erik Rodner
  4. * @date 12/09/2009
  5. */
  6. #ifndef _NICE_OBJREC_REGGAUSSIANPROCESSINCLUDE
  7. #define _NICE_OBJREC_REGGAUSSIANPROCESSINCLUDE
  8. #include "core/basics/Config.h"
  9. #include "vislearning/math/kernels/KernelData.h"
  10. #include "vislearning/math/kernels/TraceApproximation.h"
  11. #include "vislearning/math/kernels/ParameterizedKernel.h"
  12. #include "vislearning/regression/regressionbase/RegressionAlgorithmKernel.h"
  13. #include "vislearning/regression/regressionbase/TeachWithInverseKernelMatrix.h"
  14. #include "vislearning/regression/gpregression/modelselcrit/genericGPModelSelection.h"
  15. namespace OBJREC {
  16. /** @class RegGaussianProcess
  17. * Regression using Gaussian Processes
  18. *
  19. * @author Erik Rodner
  20. */
  21. class RegGaussianProcess : public RegressionAlgorithmKernel
  22. {
  23. protected:
  24. enum {
  25. OPTIMIZATION_METHOD_RASMUSSEN = 0,
  26. OPTIMIZATION_METHOD_TRUSTREGION
  27. };
  28. NICE::Vector kInvY;
  29. bool verbose;
  30. bool optimizeParameters;
  31. int optimizationMethod;
  32. int maxIterations;
  33. TraceApproximation *traceApproximation;
  34. GPMSCLooLikelihoodRegression *modelselcrit;
  35. bool useLooParameters;
  36. public:
  37. /** simple constructor */
  38. RegGaussianProcess( const NICE::Config *conf,
  39. Kernel *kernelFunction = NULL,
  40. const std::string & section = "RegGaussianProcess" );
  41. /** copy constructor */
  42. RegGaussianProcess ( const RegGaussianProcess & src );
  43. /** simple destructor */
  44. virtual ~RegGaussianProcess();
  45. /** learn parameters/models/whatever with a kernel matrix of a set
  46. * of vectors and the corresponding function values \c y
  47. */
  48. void teach ( KernelData *kernelData, const NICE::Vector & y );
  49. /** predict the function value for a vector by using its kernel values with
  50. * the used training set, be careful with the order in \c kernelVector
  51. */
  52. double predictKernel ( const NICE::Vector & kernelVector, double kernelSelf );
  53. virtual RegGaussianProcess *clone(void) const;
  54. void setOptimization ( bool optimizeParameters ) { this->optimizeParameters = optimizeParameters; };
  55. void restore(std::istream& ifs, int type = 0);
  56. void store(std::ostream& ofs, int type = 0) const;
  57. // moved to KernelData: std::pair< NICE::Vector, NICE::Vector> get_loo_estimates() const;
  58. };
  59. }
  60. #endif