KCGPOneClass.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @file KCGPOneClass.h
  3. * @brief One-Class Gaussian Process Regression for Classification
  4. * @author Erik Rodner + Mi.Ke.
  5. * @date 12/03/2010
  6. */
  7. #ifndef KCGPONECLASSINCLUDE
  8. #define KCGPONECLASSINCLUDE
  9. #include "vislearning/classifier/classifierbase/KernelClassifier.h"
  10. #include "vislearning/math/kernels/ParameterizedKernel.h"
  11. #include "vislearning/regression/regressionbase/RegressionAlgorithmKernel.h"
  12. #undef ROADWORKS
  13. #define ROADWORKS fthrow(Exception, "Persistent interface not implemented!");
  14. #define VARIANCE_DETECTION_MODE 1
  15. #define MEAN_DETECTION_MODE 2
  16. namespace OBJREC {
  17. /** Gaussian Process Regression for One-Class Classification (actually same as binary, don't use parameter optimization!!!)*/
  18. class KCGPOneClass : public KernelClassifier
  19. {
  20. protected:
  21. RegressionAlgorithmKernel *regressionAlgorithm;
  22. NICE::Matrix InverseKernelMatrix; //only used when 'variance mode' is used and computeInverse=true
  23. KernelData *kernelData; ////only used when 'variance mode' is used and computeInverse=false
  24. NICE::Vector y;
  25. int mode;
  26. bool computeInverse;
  27. double staticNoise;
  28. public:
  29. /** simple constructor */
  30. KCGPOneClass( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "OneClassGP" );
  31. /** copy constructor */
  32. KCGPOneClass( const KCGPOneClass & src );
  33. /** simple destructor */
  34. virtual ~KCGPOneClass();
  35. /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
  36. void teach ( KernelData *kernelData, const NICE::Vector & y );
  37. /** classify an example by using its kernel values with the training set,
  38. be careful with the order in @param kernelVector */
  39. virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  40. /** clone this object */
  41. KCGPOneClass *clone() const;
  42. void restore(std::istream&, int) { ROADWORKS };
  43. void store(std::ostream&, int) const { ROADWORKS };
  44. void clear() { ROADWORKS };
  45. };
  46. }
  47. #undef ROADWORKS
  48. #endif