KCMinimumEnclosingBall.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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(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. /** Minimum Enclosing Ball Algorithm (For stationary kernels equal to 1-SVM)*/
  19. class KCMinimumEnclosingBall : public KernelClassifier
  20. {
  21. protected:
  22. int trainingSize;
  23. double radius;
  24. double aKa;
  25. double nu;
  26. QuadProgPP::Matrix<double> TwoK,Eye,Ones,ones;
  27. QuadProgPP::Vector<double> alpha,b,minusDiagK,minusOne,zeros;
  28. public:
  29. /** simple constructor */
  30. KCMinimumEnclosingBall( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "KCGMinimumEnclosingBall" );
  31. /** copy constructor */
  32. KCMinimumEnclosingBall( const KCMinimumEnclosingBall & src );
  33. /** simple destructor */
  34. virtual ~KCMinimumEnclosingBall();
  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. KCMinimumEnclosingBall *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