1 | #ifndef _theplu_yat_utility_wenni_ |
---|
2 | #define _theplu_yat_utility_wenni_ |
---|
3 | |
---|
4 | // $Id: WeNNI.h 1725 2009-01-15 16:57:36Z jari $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2004 Jari Häkkinen |
---|
8 | Copyright (C) 2005 Jari Häkkinen, Peter Johansson |
---|
9 | Copyright (C) 2006 Jari Häkkinen |
---|
10 | Copyright (C) 2007 Jari Häkkinen, Peter Johansson |
---|
11 | Copyright (C) 2008 Peter Johansson |
---|
12 | Copyright (C) 2009 Jari Häkkinen |
---|
13 | |
---|
14 | This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
15 | |
---|
16 | The yat library is free software; you can redistribute it |
---|
17 | and/or modify it under the terms of the GNU General Public License |
---|
18 | as published by the Free Software Foundation; either version 3 of |
---|
19 | the License, or (at your option) any later version. |
---|
20 | |
---|
21 | The yat library is distributed in the hope that it will be |
---|
22 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
---|
23 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
24 | General Public License for more details. |
---|
25 | |
---|
26 | You should have received a copy of the GNU General Public License |
---|
27 | along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
28 | */ |
---|
29 | |
---|
30 | #include "NNI.h" |
---|
31 | #include "Matrix.h" |
---|
32 | |
---|
33 | #include <iostream> |
---|
34 | |
---|
35 | namespace theplu { |
---|
36 | namespace yat { |
---|
37 | namespace utility { |
---|
38 | |
---|
39 | /** |
---|
40 | \brief Weighted Nearest Neighbour Imputation |
---|
41 | |
---|
42 | WeNNI is a continuous weights generalization of the (binary |
---|
43 | weights) kNNI algorithm presented by Troyanskaya et al. A |
---|
44 | reference to this paper is found in the NNI document referred to |
---|
45 | in the NNI class documentation. The NNI document also describes |
---|
46 | WeNNI in depth. |
---|
47 | |
---|
48 | \note Missing values should be represented with a zero |
---|
49 | weight. WeNNI will treat the corresponding data values as zero, |
---|
50 | i.e., this implies that NaNs and Infs with zero weight will not |
---|
51 | have any impact on calculations.a |
---|
52 | |
---|
53 | \see NNI and kNNI |
---|
54 | */ |
---|
55 | class WeNNI : public NNI |
---|
56 | { |
---|
57 | public: |
---|
58 | /// |
---|
59 | /// Constructor |
---|
60 | /// |
---|
61 | WeNNI(const utility::Matrix& matrix,const utility::Matrix& weight, |
---|
62 | const unsigned int neighbours); |
---|
63 | |
---|
64 | /// |
---|
65 | /// Perform WeNNI on data in \a matrix with continuous uncertainty |
---|
66 | /// weights in \a weight using \a neighbours for the new impute |
---|
67 | /// value. |
---|
68 | /// |
---|
69 | unsigned int estimate(void); |
---|
70 | |
---|
71 | /// |
---|
72 | /// @return A const reference to imputed_data_raw. |
---|
73 | /// |
---|
74 | const utility::Matrix& imputed_data_raw(void) const |
---|
75 | { return imputed_data_raw_; } |
---|
76 | |
---|
77 | |
---|
78 | private: |
---|
79 | |
---|
80 | utility::Matrix imputed_data_raw_; |
---|
81 | }; |
---|
82 | |
---|
83 | }}} // of namespace utility, yat, and theplu |
---|
84 | |
---|
85 | #endif |
---|