VCSVMOneClass.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @file VCSVMOneClass.cpp
  3. * @brief One-Class SVM Using C-SVM implementation of T. Joachims (SVM-light)
  4. * @author Erik Rodner + Mi.Ke.
  5. * @date 12/03/2010
  6. */
  7. #ifndef VCSVMONECLASSINCLUDE
  8. #define VCSVMONECLASSINCLUDE
  9. #ifdef NICE_USELIB_SVMLIGHT
  10. #include <vislearning/nice.h>
  11. extern "C" {
  12. #include <svm_common.h>
  13. #include <svm_learn.h>
  14. }
  15. #include "vislearning/cbaselib/LabeledSet.h"
  16. #include "vislearning/classifier/classifierbase/VecClassifier.h"
  17. #include "vislearning/classifier/vclassifier/VCSVMLight.h"
  18. #include "VCLogisticRegression.h"
  19. namespace OBJREC {
  20. /** Interface to SVMLight from T. Joachims */
  21. class VCSVMOneClass : public VecClassifier
  22. {
  23. protected:
  24. VCSVMLight *svm;
  25. public:
  26. /** using a config file to read some settings */
  27. VCSVMOneClass( const NICE::Config *conf, const std::string & section = "VCSVMLight" );
  28. /** simple copy constructor */
  29. VCSVMOneClass ( const VCSVMOneClass & src );
  30. /** simple destructor */
  31. virtual ~VCSVMOneClass();
  32. /** classify using simple vector */
  33. ClassificationResult classify ( const NICE::Vector & x ) const;
  34. /** classify using a simple vector */
  35. void teach ( const LabeledSetVector & teachSet );
  36. void finishTeaching();
  37. /** clone this object */
  38. virtual VCSVMOneClass *clone(void) const;
  39. void clear ();
  40. void read (const std::string& s, int format = 0);
  41. void save (const std::string& s, int format = 0) const;
  42. void store ( std::ostream & os, int format = 0 ) const;
  43. void restore ( std::istream & is, int format = 0 );
  44. };
  45. } // namespace
  46. #endif
  47. #endif