KCGPLaplace.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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(Exception, "Persistent interface not implemented!");
  15. namespace OBJREC {
  16. /** Gaussian Process Regression for Classification */
  17. class KCGPLaplace : public KernelClassifier
  18. {
  19. protected:
  20. enum {
  21. OPTIMIZATION_METHOD_RASMUSSEN = 0,
  22. OPTIMIZATION_METHOD_TRUSTREGION
  23. };
  24. int optimizationMethod;
  25. bool verbose;
  26. bool optimizeParameters;
  27. NICE::Vector y;
  28. LaplaceApproximation laplaceApproximation;
  29. LikelihoodFunction *likelihoodFunction;
  30. public:
  31. /** simple constructor */
  32. KCGPLaplace( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "KCGPLaplace" );
  33. /** copy constructor */
  34. KCGPLaplace( const KCGPLaplace & src );
  35. /** simple destructor */
  36. virtual ~KCGPLaplace();
  37. /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
  38. void teach ( KernelData *kernelData, const NICE::Vector & y );
  39. /** classify an example by using its kernel values with the training set,
  40. be careful with the order in @param kernelVector */
  41. virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  42. /** clone this object */
  43. KCGPLaplace *clone() const;
  44. void restore(std::istream&, int) { ROADWORKS };
  45. void store(std::ostream&, int) const { ROADWORKS };
  46. void clear() { ROADWORKS };
  47. };
  48. }
  49. #undef ROADWORKS
  50. #endif