source: trunk/yat/classifier/KNN_ReciprocalRank.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: 1.0 KB
Line 
1#ifndef theplu_yat_classifier_knn_reciprocal_rank_h
2#define theplu_yat_classifier_knn_reciprocal_rank_h
3
4// $Id: KNN_ReciprocalRank.h 1112 2008-02-21 14:59:30Z markus $
5
6
7#include <vector>
8
9namespace theplu {
10namespace yat {
11 
12  namespace utility {
13    class VectorBase;
14    class VectorMutable;
15  }
16
17namespace classifier {
18
19  class Target;
20 
21
22  ///
23  /// @brief A model of the concept \ref concept_neighbor_weighting to
24  /// be used with KNN to weight the votes of the k nearest neighbors
25  /// of a sample.
26  ///
27  /// KNN_ReciprocalRank weights the vote of a nearest neighbor with
28  /// its reciprocal rank. The class of the nearest neighbor gets
29  /// the vote 1/1, the class of the second nearest neighbor gets the
30  /// vote 1/2, and so on
31  ///
32  struct KNN_ReciprocalRank
33  {   
34    /**
35       The total vote for each class is calculated and returned in prediction.
36    */
37    void operator()(const utility::VectorBase& distance,
38                    const std::vector<size_t> k_sorted,
39                    const Target& target, 
40                    utility::VectorMutable& prediction) const;   
41  };
42
43}}} // of namespace classifier, yat, and theplu
44   
45#endif
Note: See TracBrowser for help on using the repository browser.