RegGaussianProcess.h 2.4 KB

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