1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * @file VCNearestNeighbour.h
- * @brief Simple K-Nearest-Neighbour Implementation
- * @author Erik Rodner
- * @date 10/25/2007
- */
- #ifndef VCNEARESTNEIGHBOURINCLUDE
- #define VCNEARESTNEIGHBOURINCLUDE
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #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
|