680 |
11 Oct 06 |
jari |
1 |
#ifndef _theplu_yat_utility_wenni_ |
4125 |
14 Jan 22 |
peter |
2 |
#define _theplu_yat_utility_wenni_ |
616 |
31 Aug 06 |
jari |
3 |
|
145 |
05 Sep 04 |
jari |
// $Id$ |
145 |
05 Sep 04 |
jari |
5 |
|
570 |
05 Apr 06 |
jari |
6 |
/* |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2004 Jari Häkkinen |
1746 |
23 Jan 09 |
peter |
Copyright (C) 2005 Peter Johansson |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2006 Jari Häkkinen |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2009 Jari Häkkinen |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2022 Peter Johansson |
570 |
05 Apr 06 |
jari |
14 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
570 |
05 Apr 06 |
jari |
16 |
|
675 |
10 Oct 06 |
jari |
The yat library is free software; you can redistribute it |
570 |
05 Apr 06 |
jari |
and/or modify it under the terms of the GNU General Public License |
1486 |
09 Sep 08 |
jari |
as published by the Free Software Foundation; either version 3 of |
570 |
05 Apr 06 |
jari |
the License, or (at your option) any later version. |
570 |
05 Apr 06 |
jari |
21 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be |
570 |
05 Apr 06 |
jari |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
570 |
05 Apr 06 |
jari |
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
570 |
05 Apr 06 |
jari |
General Public License for more details. |
570 |
05 Apr 06 |
jari |
26 |
|
570 |
05 Apr 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
570 |
05 Apr 06 |
jari |
29 |
*/ |
570 |
05 Apr 06 |
jari |
30 |
|
680 |
11 Oct 06 |
jari |
31 |
#include "NNI.h" |
1121 |
22 Feb 08 |
peter |
32 |
#include "Matrix.h" |
145 |
05 Sep 04 |
jari |
33 |
|
145 |
05 Sep 04 |
jari |
34 |
namespace theplu { |
680 |
11 Oct 06 |
jari |
35 |
namespace yat { |
301 |
30 Apr 05 |
peter |
36 |
namespace utility { |
145 |
05 Sep 04 |
jari |
37 |
|
1725 |
15 Jan 09 |
jari |
38 |
/** |
1725 |
15 Jan 09 |
jari |
\brief Weighted Nearest Neighbour Imputation |
1725 |
15 Jan 09 |
jari |
40 |
|
1725 |
15 Jan 09 |
jari |
WeNNI is a continuous weights generalization of the (binary |
1725 |
15 Jan 09 |
jari |
weights) kNNI algorithm presented by Troyanskaya et al. A |
1725 |
15 Jan 09 |
jari |
reference to this paper is found in the NNI document referred to |
1725 |
15 Jan 09 |
jari |
in the NNI class documentation. The NNI document also describes |
1725 |
15 Jan 09 |
jari |
WeNNI in depth. |
1725 |
15 Jan 09 |
jari |
46 |
|
1725 |
15 Jan 09 |
jari |
\note Missing values should be represented with a zero |
1725 |
15 Jan 09 |
jari |
weight. WeNNI will treat the corresponding data values as zero, |
1725 |
15 Jan 09 |
jari |
i.e., this implies that NaNs and Infs with zero weight will not |
1725 |
15 Jan 09 |
jari |
have any impact on calculations.a |
1725 |
15 Jan 09 |
jari |
51 |
|
1725 |
15 Jan 09 |
jari |
\see NNI and kNNI |
1725 |
15 Jan 09 |
jari |
53 |
*/ |
145 |
05 Sep 04 |
jari |
54 |
class WeNNI : public NNI |
145 |
05 Sep 04 |
jari |
55 |
{ |
145 |
05 Sep 04 |
jari |
56 |
public: |
228 |
01 Feb 05 |
peter |
57 |
/// |
228 |
01 Feb 05 |
peter |
/// Constructor |
228 |
01 Feb 05 |
peter |
59 |
/// |
4125 |
14 Jan 22 |
peter |
60 |
WeNNI(const MatrixBase& matrix, const MatrixBase& weight, |
1271 |
09 Apr 08 |
peter |
61 |
const unsigned int neighbours); |
228 |
01 Feb 05 |
peter |
62 |
|
1726 |
15 Jan 09 |
jari |
63 |
/** |
1726 |
15 Jan 09 |
jari |
\brief Function doing WeNNI imputation. |
1726 |
15 Jan 09 |
jari |
65 |
|
1726 |
15 Jan 09 |
jari |
Perform WeNNI on data in \a matrix with continuous uncertainty |
1726 |
15 Jan 09 |
jari |
weights in \a weight using \a neighbours for the new impute |
1726 |
15 Jan 09 |
jari |
value. |
1726 |
15 Jan 09 |
jari |
69 |
|
1726 |
15 Jan 09 |
jari |
The return value can be used as an indication of how well the |
1726 |
15 Jan 09 |
jari |
imputation worked. The return value should be zero if proper |
1726 |
15 Jan 09 |
jari |
pre-processing of data is done. An example of bad data is a |
1726 |
15 Jan 09 |
jari |
matrix with a column of zero weights, another is a |
1726 |
15 Jan 09 |
jari |
corresponding situation with a row with all weights zero. |
1726 |
15 Jan 09 |
jari |
75 |
|
1726 |
15 Jan 09 |
jari |
\return The number of rows that have at least one value not |
1726 |
15 Jan 09 |
jari |
imputed. |
1726 |
15 Jan 09 |
jari |
78 |
*/ |
1271 |
09 Apr 08 |
peter |
79 |
unsigned int estimate(void); |
146 |
08 Sep 04 |
jari |
80 |
|
233 |
21 Feb 05 |
peter |
81 |
/// |
246 |
23 Feb 05 |
peter |
/// @return A const reference to imputed_data_raw. |
233 |
21 Feb 05 |
peter |
83 |
/// |
4125 |
14 Jan 22 |
peter |
84 |
const Matrix& imputed_data_raw(void) const; |
233 |
21 Feb 05 |
peter |
85 |
|
146 |
08 Sep 04 |
jari |
86 |
private: |
4125 |
14 Jan 22 |
peter |
87 |
Matrix imputed_data_raw_; |
145 |
05 Sep 04 |
jari |
88 |
}; |
145 |
05 Sep 04 |
jari |
89 |
|
687 |
16 Oct 06 |
jari |
90 |
}}} // of namespace utility, yat, and theplu |
145 |
05 Sep 04 |
jari |
91 |
|
145 |
05 Sep 04 |
jari |
92 |
#endif |