KCGPApproxOneClass.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #include "vislearning/math/kernels/ParameterizedKernel.h"
  13. #include "vislearning/regression/regressionbase/RegressionAlgorithmKernel.h"
  14. #define VARIANCE_DETECTION_MODE 1
  15. #define MEAN_DETECTION_MODE 2
  16. namespace OBJREC {
  17. class KCGPApproxOneClass : public KernelClassifier
  18. {
  19. protected:
  20. NICE::Vector matrixDInv;
  21. NICE::Vector InvDY;
  22. int mode;
  23. double staticNoise;
  24. public:
  25. /** simple constructor */
  26. KCGPApproxOneClass( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "OneClassGP" );
  27. /** copy constructor */
  28. KCGPApproxOneClass( const KCGPApproxOneClass & src );
  29. /** simple destructor */
  30. virtual ~KCGPApproxOneClass();
  31. /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
  32. void teach ( KernelData *kernelData, const NICE::Vector & y );
  33. void teach (const LabeledSetVector &teachSet);
  34. /** classify an example by using its kernel values with the training set,
  35. be careful with the order in @param kernelVector */
  36. // ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  37. virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  38. /** clone this object */
  39. KCGPApproxOneClass *clone() const;
  40. void restore(std::istream&, int);
  41. void store(std::ostream&, int) const;
  42. void clear(){};
  43. };
  44. }
  45. #endif