yat
0.8.3pre
|
00001 #ifndef _theplu_yat_utility_nni_ 00002 #define _theplu_yat_utility_nni_ 00003 00004 // $Id: NNI.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2004 Jari Häkkinen 00008 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 00009 Copyright (C) 2009 Jari Häkkinen 00010 00011 This file is part of the yat library, http://dev.thep.lu.se/yat 00012 00013 The yat library is free software; you can redistribute it and/or 00014 modify it under the terms of the GNU General Public License as 00015 published by the Free Software Foundation; either version 3 of the 00016 License, or (at your option) any later version. 00017 00018 The yat library is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 along with yat. If not, see <http://www.gnu.org/licenses/>. 00025 */ 00026 00027 #include "Matrix.h" 00028 00029 #include <utility> 00030 #include <vector> 00031 00032 namespace theplu { 00033 namespace yat { 00034 namespace utility { 00035 00079 class NNI 00080 { 00081 public: 00082 00087 NNI(const utility::Matrix& matrix,const utility::Matrix& weight, 00088 const unsigned int neighbours); 00089 00090 virtual ~NNI(void) {}; 00091 00104 virtual unsigned int estimate(void)=0; 00105 00109 const utility::Matrix& imputed_data(void) const; 00110 00114 const std::vector<size_t>& not_imputed(void) const; 00115 00116 protected: 00121 std::vector<std::pair<size_t,double> > 00122 calculate_distances(const size_t) const; 00126 std::vector<size_t> 00127 nearest_neighbours(const size_t, 00128 const std::vector<std::pair<size_t,double> >&) const; 00132 const utility::Matrix& data_; 00133 00137 utility::Matrix imputed_data_; 00138 00142 unsigned int neighbours_; 00143 00147 std::vector<size_t> not_imputed_; 00148 00152 const utility::Matrix& weight_; 00153 }; 00154 00155 }}} // of namespace utility, yat, and theplu 00156 00157 #endif