VCNearestClassMean.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * @file VCNearestClassMean.h
  3. * @brief Nearest Class Mean Classifier (Naive Bayes with identity covariance matrix for all classes) -> code is based on VCSimpleGaussian and VCNearestNeighbor
  4. * @author Erik Rodner + Mi.Ke
  5. * @date 12/05/2007
  6. */
  7. #ifdef NICE_USELIB_ICE
  8. #ifndef VCNEARESTCLASSMEANINCLUDE
  9. #define VCNEARESTCLASSMEANINCLUDE
  10. #include "vislearning/classifier/classifierbase/VecClassifier.h"
  11. #include <core/vector/Distance.h>
  12. #include <image_nonvis.h>
  13. namespace OBJREC {
  14. /** Simple Gaussian Classifier */
  15. class VCNearestClassMean : public VecClassifier
  16. {
  17. public:
  18. std::vector<NICE::Vector> means;
  19. std::vector<int> classNo;
  20. NICE::VectorDistance<double> *distancefunc;
  21. std::map<int, ice::Statistics *> statistics;
  22. public:
  23. /** simple constructor */
  24. VCNearestClassMean( const NICE::Config *conf, NICE::VectorDistance<double> *distancefunc = NULL );
  25. /** simple destructor */
  26. virtual ~VCNearestClassMean();
  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 clear ();
  33. void store ( std::ostream & os, int format = 0 ) const;
  34. void restore ( std::istream & is, int format = 0 );
  35. };
  36. } // namespace
  37. #endif //VCNEARESTCLASSMEANINCLUDE
  38. #endif //NICE_USELIB_ICE