VCOneVsOne.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "vislearning/classifier/classifierbase/VecClassifier.h"
  12. #include "core/basics/triplet.h"
  13. namespace OBJREC {
  14. /** one-vs.-one svm voting */
  15. class VCOneVsOne : public VecClassifier
  16. {
  17. protected:
  18. VecClassifier *prototype;
  19. std::vector< triplet<int, int, VecClassifier *> > classifiers;
  20. bool use_weighted_voting;
  21. public:
  22. /** simple constructor */
  23. VCOneVsOne( const NICE::Config *conf, VecClassifier *prototype );
  24. /** simple destructor */
  25. virtual ~VCOneVsOne();
  26. /** classify using simple vector */
  27. ClassificationResult classify ( const NICE::Vector & x ) const;
  28. /** classify using a simple vector */
  29. void teach ( const LabeledSetVector & teachSet );
  30. void finishTeaching();
  31. void read (const std::string& s, int format = 0);
  32. void save (const std::string& s, int format = 0) const;
  33. void clear () { classifiers.clear(); };
  34. void store ( std::ostream & os, int format = 0 ) const;
  35. void restore ( std::istream & is, int format = 0 );
  36. };
  37. } // namespace
  38. #endif