KCGPLaplace.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * @file KCGPLaplace.h
  3. * @brief Gaussian Process Regression for Classification
  4. * @author Erik Rodner
  5. * @date 12/03/2009
  6. */
  7. #ifndef KCGPLAPLACEINCLUDE
  8. #define KCGPLAPLACEINCLUDE
  9. #include "vislearning/classifier/classifierbase/KernelClassifier.h"
  10. #include "vislearning/math/kernels/ParameterizedKernel.h"
  11. #include "vislearning/classifier/kernelclassifier/LaplaceApproximation.h"
  12. #include "vislearning/classifier/kernelclassifier/LikelihoodFunction.h"
  13. #undef ROADWORKS
  14. #define ROADWORKS fthrow(NICE::Exception, "Persistent interface not implemented!");
  15. namespace OBJREC
  16. {
  17. /** Gaussian Process Regression for Classification */
  18. class KCGPLaplace : public KernelClassifier
  19. {
  20. protected:
  21. enum
  22. {
  23. OPTIMIZATION_METHOD_RASMUSSEN = 0,
  24. OPTIMIZATION_METHOD_TRUSTREGION
  25. };
  26. int optimizationMethod;
  27. bool verbose;
  28. bool optimizeParameters;
  29. NICE::Vector y;
  30. LaplaceApproximation laplaceApproximation;
  31. LikelihoodFunction *likelihoodFunction;
  32. public:
  33. /** simple constructor */
  34. KCGPLaplace ( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "KCGPLaplace" );
  35. /** copy constructor */
  36. KCGPLaplace ( const KCGPLaplace & src );
  37. /** simple destructor */
  38. virtual ~KCGPLaplace();
  39. /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
  40. void teach ( KernelData *kernelData, const NICE::Vector & y );
  41. /** classify an example by using its kernel values with the training set,
  42. be careful with the order in @param kernelVector */
  43. virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  44. /** clone this object */
  45. KCGPLaplace *clone() const;
  46. void restore ( std::istream&, int )
  47. {
  48. ROADWORKS
  49. };
  50. void store ( std::ostream&, int ) const
  51. {
  52. ROADWORKS
  53. };
  54. void clear()
  55. {
  56. ROADWORKS
  57. };
  58. };
  59. }
  60. #undef ROADWORKS
  61. #endif