KCMinimumEnclosingBall.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 KCMINIMUMENCLOSINGBALLINCLUDE
  8. #define KCMINIMUMENCLOSINGBALLINCLUDE
  9. #include "vislearning/classifier/classifierbase/KernelClassifier.h"
  10. #include "vislearning/math/kernels/ParameterizedKernel.h"
  11. #undef ROADWORKS
  12. #define ROADWORKS fthrow(NICE::Exception, "Persistent interface not implemented!");
  13. #define VARIANCE_DETECTION_MODE 1
  14. #define MEAN_DETECTION_MODE 2
  15. #include "vislearning/optimization/quadprog/QuadProg++.h"
  16. #include "vislearning/optimization/quadprog/Array.h"
  17. namespace OBJREC
  18. {
  19. /** Minimum Enclosing Ball Algorithm (For stationary kernels equal to 1-SVM)*/
  20. class KCMinimumEnclosingBall : public KernelClassifier
  21. {
  22. protected:
  23. int trainingSize;
  24. double radius;
  25. double aKa;
  26. double nu;
  27. QuadProgPP::Matrix<double> TwoK,Eye,Ones,ones;
  28. QuadProgPP::Vector<double> alpha,b,minusDiagK,minusOne,zeros;
  29. public:
  30. /** simple constructor */
  31. KCMinimumEnclosingBall ( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "KCGMinimumEnclosingBall" );
  32. /** copy constructor */
  33. KCMinimumEnclosingBall ( const KCMinimumEnclosingBall & src );
  34. /** simple destructor */
  35. virtual ~KCMinimumEnclosingBall();
  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. KCMinimumEnclosingBall *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