12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- /**
- * @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
|