VCOneVsOne.h 1.3 KB

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