KCGPOneClass.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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(NICE::Exception, "Persistent interface not implemented!");
  14. #define VARIANCE_DETECTION_MODE 1
  15. #define MEAN_DETECTION_MODE 2
  16. namespace OBJREC
  17. {
  18. /** Gaussian Process Regression for One-Class Classification (actually same as binary, don't use parameter optimization!!!)*/
  19. class KCGPOneClass : public KernelClassifier
  20. {
  21. protected:
  22. RegressionAlgorithmKernel *regressionAlgorithm;
  23. NICE::Matrix InverseKernelMatrix; //only used when 'variance mode' is used and computeInverse=true
  24. KernelData *kernelData; ////only used when 'variance mode' is used and computeInverse=false
  25. NICE::Vector y;
  26. int mode;
  27. bool computeInverse;
  28. double staticNoise;
  29. public:
  30. /** simple constructor */
  31. KCGPOneClass ( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "OneClassGP" );
  32. /** copy constructor */
  33. KCGPOneClass ( const KCGPOneClass & src );
  34. /** simple destructor */
  35. virtual ~KCGPOneClass();
  36. /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
  37. void teach ( KernelData *kernelData, const NICE::Vector & y );
  38. /** classify an example by using its kernel values with the training set,
  39. be careful with the order in @param kernelVector */
  40. virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;
  41. /** clone this object */
  42. KCGPOneClass *clone() const;
  43. void restore ( std::istream&, int )
  44. {
  45. ROADWORKS
  46. };
  47. void store ( std::ostream&, int ) const
  48. {
  49. ROADWORKS
  50. };
  51. void clear()
  52. {
  53. ROADWORKS
  54. };
  55. };
  56. }
  57. #undef ROADWORKS
  58. #endif