source: trunk/yat/utility/WeNNI.h @ 2119

Last change on this file since 2119 was 2119, checked in by Peter, 12 years ago

converted files to utf-8. fixes #577

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