yat/utility/kNNI.h

Code
Comments
Other
Rev Date Author Line
680 11 Oct 06 jari 1 #ifndef _theplu_yat_utility_knni_
4200 19 Aug 22 peter 2 #define _theplu_yat_utility_knni_
616 31 Aug 06 jari 3
145 05 Sep 04 jari 4 // $Id$
145 05 Sep 04 jari 5
570 05 Apr 06 jari 6 /*
2119 12 Dec 09 peter 7   Copyright (C) 2004 Jari Häkkinen
2119 12 Dec 09 peter 8   Copyright (C) 2005 Jari Häkkinen, Peter Johansson
2119 12 Dec 09 peter 9   Copyright (C) 2006 Jari Häkkinen
4359 23 Aug 23 peter 10   Copyright (C) 2007 Peter Johansson
4359 23 Aug 23 peter 11   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
2119 12 Dec 09 peter 12   Copyright (C) 2009 Jari Häkkinen
4207 26 Aug 22 peter 13   Copyright (C) 2022 Peter Johansson
570 05 Apr 06 jari 14
1437 25 Aug 08 peter 15   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 17   The yat library is free software; you can redistribute it and/or
675 10 Oct 06 jari 18   modify it under the terms of the GNU General Public License as
1486 09 Sep 08 jari 19   published by the Free Software Foundation; either version 3 of the
675 10 Oct 06 jari 20   License, or (at your option) any later version.
570 05 Apr 06 jari 21
675 10 Oct 06 jari 22   The yat library is distributed in the hope that it will be useful,
675 10 Oct 06 jari 23   but WITHOUT ANY WARRANTY; without even the implied warranty of
675 10 Oct 06 jari 24   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
570 05 Apr 06 jari 25   General Public License for more details.
570 05 Apr 06 jari 26
570 05 Apr 06 jari 27   You should have received a copy of the GNU General Public License
1487 10 Sep 08 jari 28   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"
145 05 Sep 04 jari 32
145 05 Sep 04 jari 33 #include <vector>
145 05 Sep 04 jari 34
145 05 Sep 04 jari 35 namespace theplu {
680 11 Oct 06 jari 36 namespace yat {
301 30 Apr 05 peter 37 namespace utility {
145 05 Sep 04 jari 38
145 05 Sep 04 jari 39   ///
767 22 Feb 07 peter 40   /// @brief kNNimpute
767 22 Feb 07 peter 41   ///
177 01 Oct 04 jari 42   /// kNNI is the binary weight implementation of NNI. This follows
178 01 Oct 04 jari 43   /// the work done by Troyanskaya et al. cited in the NNI document
177 01 Oct 04 jari 44   /// referred to in the NNI class documentation.
145 05 Sep 04 jari 45   ///
177 01 Oct 04 jari 46   /// This is a special case of the WeNNI, but is maintained since it
177 01 Oct 04 jari 47   /// is faster than the more general WeNNI.
177 01 Oct 04 jari 48   ///
177 01 Oct 04 jari 49   /// @see NNI and WeNNI
177 01 Oct 04 jari 50   ///
145 05 Sep 04 jari 51   class kNNI : public NNI
145 05 Sep 04 jari 52   {
145 05 Sep 04 jari 53   public:
228 01 Feb 05 peter 54     ///
228 01 Feb 05 peter 55     /// Constructor
228 01 Feb 05 peter 56     ///
4125 14 Jan 22 peter 57     kNNI(const MatrixBase& matrix, const MatrixBase& weight,
1271 09 Apr 08 peter 58          const unsigned int neighbours);
228 01 Feb 05 peter 59
1726 15 Jan 09 jari 60     /**
1726 15 Jan 09 jari 61        \brief Function doing kNNI imputation.
1726 15 Jan 09 jari 62
1726 15 Jan 09 jari 63        Perform kNNI on data in \a matrix with binary uncertainty
1726 15 Jan 09 jari 64        weights in \a weight using \a neighbours for the new impute
1726 15 Jan 09 jari 65        value.
1726 15 Jan 09 jari 66
1726 15 Jan 09 jari 67        The return value can be used as an indication of how well the
1726 15 Jan 09 jari 68        imputation worked. The return value should be zero if proper
1726 15 Jan 09 jari 69        pre-processing of data is done. An example of bad data is a
1726 15 Jan 09 jari 70        matrix with a column of zero weights, another is a
1726 15 Jan 09 jari 71        corresponding situation with a row with all weights zero.
1726 15 Jan 09 jari 72
1726 15 Jan 09 jari 73        \return The number of rows that have at least one value not
1726 15 Jan 09 jari 74        imputed.
1726 15 Jan 09 jari 75     */
1271 09 Apr 08 peter 76     unsigned int estimate(void);
146 08 Sep 04 jari 77
146 08 Sep 04 jari 78   private:
1271 09 Apr 08 peter 79     std::vector<size_t> mv_rows_;  // index to rows that have values to estimate
145 05 Sep 04 jari 80   };
145 05 Sep 04 jari 81
687 16 Oct 06 jari 82 }}} // of namespace utility, yat, and theplu
145 05 Sep 04 jari 83
145 05 Sep 04 jari 84 #endif