source: trunk/yat/utility/WeNNI.h

Last change on this file was 2526, checked in by Peter, 10 years ago

update copyright years

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1#ifndef _theplu_yat_utility_wenni_
2#define _theplu_yat_utility_wenni_
3
4// $Id: WeNNI.h 2526 2011-07-25 02:03:35Z 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  Copyright (C) 2011 Peter Johansson
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
33namespace theplu {
34namespace yat {
35namespace utility {
36
37  /**
38     \brief Weighted Nearest Neighbour Imputation
39
40     WeNNI is a continuous weights generalization of the (binary
41     weights) kNNI algorithm presented by Troyanskaya et al. A
42     reference to this paper is found in the NNI document referred to
43     in the NNI class documentation. The NNI document also describes
44     WeNNI in depth.
45
46     \note Missing values should be represented with a zero
47     weight. WeNNI will treat the corresponding data values as zero,
48     i.e., this implies that NaNs and Infs with zero weight will not
49     have any impact on calculations.a
50
51     \see NNI and kNNI
52  */
53  class WeNNI : public NNI
54  {
55  public:
56    ///
57    /// Constructor
58    ///
59    WeNNI(const utility::Matrix& matrix,const utility::Matrix& weight,
60          const unsigned int neighbours);
61
62    /**
63       \brief Function doing WeNNI imputation.
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       The return value can be used as an indication of how well the
70       imputation worked. The return value should be zero if proper
71       pre-processing of data is done. An example of bad data is a
72       matrix with a column of zero weights, another is a
73       corresponding situation with a row with all weights zero.
74
75       \return The number of rows that have at least one value not
76       imputed.
77    */
78    unsigned int estimate(void);
79
80    ///
81    /// @return A const reference to imputed_data_raw.
82    ///
83    const utility::Matrix& imputed_data_raw(void) const;
84
85  private:
86
87    utility::Matrix imputed_data_raw_;
88  };
89
90}}} // of namespace utility, yat, and theplu
91
92#endif
Note: See TracBrowser for help on using the repository browser.