source: trunk/yat/classifier/KNN_ReciprocalDistance.h

Last change on this file was 2986, checked in by Peter, 9 years ago

merge 0.10-stable branch into trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.7 KB
RevLine 
[1112]1#ifndef theplu_yat_classifier_knn_reciprocal_distance_h
2#define theplu_yat_classifier_knn_reciprocal_distance_h
3
4// $Id: KNN_ReciprocalDistance.h 2986 2013-02-18 08:07:44Z peter $
5
[1142]6/*
[2119]7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
[2986]8  Copyright (C) 2013 Jari Häkkinen
[1142]9
[1437]10  This file is part of the yat library, http://dev.thep.lu.se/yat
[1142]11
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
[1486]14  published by the Free Software Foundation; either version 3 of the
[1142]15  License, or (at your option) any later version.
16
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
[1487]23  along with yat. If not, see <http://www.gnu.org/licenses/>.
[1142]24*/
25
[2966]26#include <cstddef>
[1112]27#include <vector>
28
29namespace theplu {
30namespace yat {
31 
32  namespace utility {
33    class VectorBase;
34    class VectorMutable;
35  }
36
37namespace classifier {
38
39  class Target;
40 
41  ///
42  /// @brief A model of the concept \ref concept_neighbor_weighting to
43  /// be used with KNN to weight the votes of the k nearest neighbors
44  /// of a sample.
45  ///
46  /// KNN_ReciprocalDistance weights the vote of a nearest neighbor with
47  /// its reciprocal rank.
48  struct KNN_ReciprocalDistance
49  {   
50    /**
51       The total vote for each class is calculated and returned in prediction.
52    */
53    void operator()(const utility::VectorBase& dist,
[1522]54                    const std::vector<size_t>& k_sorted,
[1112]55                    const Target& target, 
56                    utility::VectorMutable& prediction) const;   
57  };
58
59}}} // of namespace classifier, yat, and theplu
60   
61#endif
Note: See TracBrowser for help on using the repository browser.