source: trunk/yat/classifier/KNN_Uniform.h @ 1112

Last change on this file since 1112 was 1112, checked in by Markus Ringnér, 14 years ago

Mostly related to #295 and #182

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 969 bytes
Line 
1#ifndef theplu_yat_classifier_knn_uniform_h
2#define theplu_yat_classifier_knn_uniform_h
3
4// $Id: KNN_Uniform.h 1112 2008-02-21 14:59:30Z markus $
5
6#include <vector>
7
8namespace theplu {
9namespace yat {
10 
11  namespace utility {
12    class VectorBase;
13    class VectorMutable;
14  }
15
16namespace classifier {
17
18  class Target;
19
20 
21  ///
22  /// @brief A model of the concept \ref concept_neighbor_weighting to
23  /// be used with KNN to weight the votes of the k nearest neighbors
24  /// of a sample.
25  ///
26  /// KNN_Uniform weights the nearest neighbours uniformly
27  /// so the total vote for a class is equal to the number of nearest
28  /// neighbors belonging to the class.
29  ///
30  struct KNN_Uniform
31  {   
32    /**
33       The total vote for each class is calculated and returned in prediction.
34    */
35    void operator()(const utility::VectorBase& distance,
36                    const std::vector<size_t> k_sorted, 
37                    const Target& target, 
38                    utility::VectorMutable& prediction) const;   
39  };
40
41}}} // of namespace classifier, yat, and theplu
42   
43#endif
Note: See TracBrowser for help on using the repository browser.