123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /**
- * @file VCNearestNeighbour.h
- * @brief Simple K-Nearest-Neighbour Implementation
- * @author Erik Rodner
- * @date 10/25/2007
- */
- #ifndef VCNEARESTNEIGHBOURINCLUDE
- #define VCNEARESTNEIGHBOURINCLUDE
- #ifdef NOVISUAL
- #include <vislearning/nice_nonvis.h>
- #else
- #include <vislearning/nice.h>
- #endif
- #include <core/vector/Distance.h>
- #include "vislearning/cbaselib/LabeledSet.h"
- #include "vislearning/classifier/classifierbase/VecClassifier.h"
- namespace OBJREC {
- /** Simple K-Nearest-Neighbour Implementation */
- class VCNearestNeighbour : public VecClassifier
- {
- protected:
- int K;
- LabeledSetVector teachSet;
- NICE::VectorDistance<double> *distancefunc;
- public:
-
- /** simple constructor */
- VCNearestNeighbour( const NICE::Config *conf, NICE::VectorDistance<double> *distancefunc = NULL );
- VCNearestNeighbour( const VCNearestNeighbour & src );
-
- /** simple destructor */
- virtual ~VCNearestNeighbour();
-
- /** classify using simple vector */
- ClassificationResult classify ( const NICE::Vector & x ) const;
- /** classify using a simple vector */
- void teach ( const LabeledSetVector & teachSet );
-
- void teach ( int classno, const NICE::Vector & x );
-
- void finishTeaching();
-
- VCNearestNeighbour *clone(void) const;
- void clear ();
-
- void store ( std::ostream & os, int format = 0 ) const;
- void restore ( std::istream & is, int format = 0 );
- };
- } // namespace
- #endif
|