source: trunk/yat/classifier/KNN_ReciprocalDistance.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: 925 bytes
Line 
1#ifndef theplu_yat_classifier_knn_reciprocal_distance_h
2#define theplu_yat_classifier_knn_reciprocal_distance_h
3
4// $Id: KNN_ReciprocalDistance.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  /// @brief A model of the concept \ref concept_neighbor_weighting to
22  /// be used with KNN to weight the votes of the k nearest neighbors
23  /// of a sample.
24  ///
25  /// KNN_ReciprocalDistance weights the vote of a nearest neighbor with
26  /// its reciprocal rank.
27  struct KNN_ReciprocalDistance
28  {   
29    /**
30       The total vote for each class is calculated and returned in prediction.
31    */
32    void operator()(const utility::VectorBase& dist,
33                    const std::vector<size_t> k_sorted,
34                    const Target& target, 
35                    utility::VectorMutable& prediction) const;   
36  };
37
38}}} // of namespace classifier, yat, and theplu
39   
40#endif
Note: See TracBrowser for help on using the repository browser.