KCGPApproxOneClass.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @file KCGPApproxOneClass.h
  3. * @brief One-Class Gaussian Process Regression for Classification: we approximate the inverse of the regularized kernel matrix using a diagonal matrix
  4. * @author Alexander Lütz
  5. * @date 22-05-2012 (dd-mm-yyyy)
  6. */
  7. #ifndef KCGPAPPROXONECLASSINCLUDE
  8. #define KCGPAPPROXONECLASSINCLUDE
  9. #include "vislearning/cbaselib/ClassificationResult.h"
  10. #include "vislearning/classifier/classifierbase/KernelClassifier.h"
  11. #include "vislearning/math/kernels/Kernel.h"
  12. #define VARIANCE_DETECTION_MODE 1
  13. #define MEAN_DETECTION_MODE 2
  14. namespace OBJREC {
  15. class KCGPApproxOneClass : public KernelClassifier
  16. {
  17. protected:
  18. NICE::Vector matrixDInv;
  19. NICE::Vector InvDY;
  20. int mode;
  21. double staticNoise;
  22. public:
  23. /** simple constructor */
  24. KCGPApproxOneClass( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "OneClassGP" );
  25. /** copy constructor */
  26. KCGPApproxOneClass( const KCGPApproxOneClass & src );
  27. /** simple destructor */
  28. virtual ~KCGPApproxOneClass();
  29. /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
  30. void teach ( KernelData *kernelData, const NICE::Vector & y );
  31. void teach (const LabeledSetVector &teachSet);
  32. /** classify an example by using its kernel values with the training set,
  33. be careful with the order in @param kernelVector */
  34. virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  35. /** clone this object */
  36. KCGPApproxOneClass *clone() const;
  37. void restore(std::istream&, int);
  38. void store(std::ostream&, int) const;
  39. void clear();
  40. };
  41. }
  42. #endif