VCOneVsOne.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @file VCOneVsOne.h
  3. * @brief one-vs.-one svm voting
  4. * @author Erik Rodner
  5. * @date 10/25/2007
  6. */
  7. #ifndef VCOneVsOneINCLUDE
  8. #define VCOneVsOneINCLUDE
  9. #ifdef NOVISUAL
  10. #include <vislearning/nice_nonvis.h>
  11. #else
  12. #include <vislearning/nice.h>
  13. #endif
  14. #include "vislearning/classifier/classifierbase/VecClassifier.h"
  15. #include "core/basics/triplet.h"
  16. namespace OBJREC {
  17. /** one-vs.-one svm voting */
  18. class VCOneVsOne : public VecClassifier
  19. {
  20. protected:
  21. VecClassifier *prototype;
  22. std::vector< triplet<int, int, VecClassifier *> > classifiers;
  23. bool use_weighted_voting;
  24. public:
  25. /** simple constructor */
  26. VCOneVsOne( const NICE::Config *conf, VecClassifier *prototype );
  27. /** simple destructor */
  28. virtual ~VCOneVsOne();
  29. /** classify using simple vector */
  30. ClassificationResult classify ( const NICE::Vector & x ) const;
  31. /** classify using a simple vector */
  32. void teach ( const LabeledSetVector & teachSet );
  33. void finishTeaching();
  34. void read (const std::string& s, int format = 0);
  35. void save (const std::string& s, int format = 0) const;
  36. void clear () { classifiers.clear(); };
  37. void store ( std::ostream & os, int format = 0 ) const;
  38. void restore ( std::istream & is, int format = 0 );
  39. };
  40. } // namespace
  41. #endif