yat/classifier/KNN_ReciprocalDistance.h

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