1 | // $Id: concepts.doxygen 1112 2008-02-21 14:59:30Z markus $ |
---|
2 | // |
---|
3 | // Copyright (C) 2008 Peter Johansson, Markus Ringnér |
---|
4 | // |
---|
5 | // This file is part of the yat library, http://trac.thep.lu.se/yat |
---|
6 | // |
---|
7 | // The yat library is free software; you can redistribute it and./or |
---|
8 | // modify it under the terms of the GNU General Public License as |
---|
9 | // published by the Free Software Foundation; either version 2 of the |
---|
10 | // License, or (at your option) any later version. |
---|
11 | // |
---|
12 | // The yat library is distributed in the hope that it will be useful, |
---|
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
15 | // General Public License for more details. |
---|
16 | // |
---|
17 | // You should have received a copy of the GNU General Public License |
---|
18 | // along with this program; if not, write to the Free Software |
---|
19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
20 | // 02111-1307, USA. |
---|
21 | |
---|
22 | |
---|
23 | /** |
---|
24 | \page Concepts Concepts |
---|
25 | |
---|
26 | This page lists all the C++ concepts in the yat project. |
---|
27 | |
---|
28 | - \subpage concept_distance |
---|
29 | - \subpage concept_neighbor_weighting |
---|
30 | */ |
---|
31 | |
---|
32 | |
---|
33 | /** |
---|
34 | \page concept_distance Distance |
---|
35 | |
---|
36 | \section Description |
---|
37 | |
---|
38 | \ref concept_distance is a concept .. |
---|
39 | |
---|
40 | \section Requirements |
---|
41 | |
---|
42 | Classes modelling the concept \ref concept_distance should implement ... |
---|
43 | |
---|
44 | Examples of classes modelling the concept \ref concept_distance |
---|
45 | include theplu::yat::statistics::PearsonDistance and |
---|
46 | theplu::yat::statistics::EuclideanDistance. |
---|
47 | |
---|
48 | */ |
---|
49 | |
---|
50 | /** |
---|
51 | \page concept_neighbor_weighting Neighbor Weighting Method |
---|
52 | |
---|
53 | \section Description |
---|
54 | |
---|
55 | \ref concept_neighbor_weighting is a concept used in connection with |
---|
56 | theplu::yat::classifier::KNN - classes used as the template argument |
---|
57 | NeighborWeighting should implement this concept. |
---|
58 | |
---|
59 | \section Requirements |
---|
60 | |
---|
61 | Classes modelling the concept \ref concept_neighbor_weighting should |
---|
62 | implement the following function: |
---|
63 | |
---|
64 | \verbatim |
---|
65 | void operator()(const utility::VectorBase& distance, const std::vector<size_t> k_sorted, |
---|
66 | const Target& target, utility::VectorMutable& prediction) const |
---|
67 | \endverbatim |
---|
68 | |
---|
69 | For a test sample, this function should calculate a total vote |
---|
70 | (i.e. based on all k nearest neighbors) for each class. The vector \a |
---|
71 | distance contains the distances from a test sample to all training |
---|
72 | samples. The vector \a k_sorted contains the indices (for both \a |
---|
73 | distance and \a target) to the k training samples with the smallest |
---|
74 | distances to the test sample. The class for each training sample is |
---|
75 | given by \a target, which is sorted in the same sample order as \a |
---|
76 | distance. For each class the function calculates a total vote based on |
---|
77 | the the nearest neighbors of the test sample that belong to the |
---|
78 | class. The total vote for each class is stored in the vector \a prediction. |
---|
79 | |
---|
80 | Examples of classes modelling the concept \ref |
---|
81 | concept_neighbor_weighting include |
---|
82 | theplu::yat::classifier::KNN_Uniform, |
---|
83 | theplu::yat::classifier::KNN_ReciprocalDistance and |
---|
84 | theplu::yat::classifier::KNN_ReciprocalRank. |
---|
85 | |
---|
86 | */ |
---|