yat  0.20.3pre
NNI.h
1 #ifndef _theplu_yat_utility_nni_
2 #define _theplu_yat_utility_nni_
3 
4 // $Id: NNI.h 4207 2022-08-26 04:36:28Z peter $
5 
6 /*
7  Copyright (C) 2004 Jari Häkkinen
8  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2009 Jari Häkkinen
10  Copyright (C) 2022 Peter Johansson
11 
12  This file is part of the yat library, http://dev.thep.lu.se/yat
13 
14  The yat library is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License as
16  published by the Free Software Foundation; either version 3 of the
17  License, or (at your option) any later version.
18 
19  The yat library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with yat. If not, see <http://www.gnu.org/licenses/>.
26 */
27 
28 #include "Matrix.h"
29 
30 #include <utility>
31 #include <vector>
32 
33 namespace theplu {
34 namespace yat {
35 namespace utility {
36 
80  class NNI
81  {
82  public:
83 
88  NNI(const utility::MatrixBase& matrix,const utility::MatrixBase& weight,
89  const unsigned int neighbours);
90 
91  virtual ~NNI(void) {};
92 
105  virtual unsigned int estimate(void)=0;
106 
110  const utility::Matrix& imputed_data(void) const;
111 
115  const std::vector<size_t>& not_imputed(void) const;
116 
117  protected:
122  std::vector<std::pair<size_t,double> >
123  calculate_distances(const size_t) const;
127  std::vector<size_t>
128  nearest_neighbours(const size_t,
129  const std::vector<std::pair<size_t,double> >&) const;
134 
139 
143  unsigned int neighbours_;
144 
148  std::vector<size_t> not_imputed_;
149 
154  };
155 
156 }}} // of namespace utility, yat, and theplu
157 
158 #endif
virtual unsigned int estimate(void)=0
Function doing the imputation.
Definition: MatrixBase.h:54
The Department of Theoretical Physics namespace as we define it.
const utility::Matrix & imputed_data(void) const
const std::vector< size_t > & not_imputed(void) const
NNI(const utility::MatrixBase &matrix, const utility::MatrixBase &weight, const unsigned int neighbours)
std::vector< std::pair< size_t, double > > calculate_distances(const size_t) const
std::vector< size_t > nearest_neighbours(const size_t, const std::vector< std::pair< size_t, double > > &) const
const utility::MatrixBase & weight_
Definition: NNI.h:153
const utility::MatrixBase & data_
Definition: NNI.h:133
unsigned int neighbours_
Definition: NNI.h:143
std::vector< size_t > not_imputed_
Definition: NNI.h:148
Interface to GSL matrix.
Definition: Matrix.h:104
Interface class for nearest neighbour imputation (NNI) algorithms.
Definition: NNI.h:80
utility::Matrix imputed_data_
Definition: NNI.h:138

Generated on Sat Feb 18 2023 03:31:44 for yat by  doxygen 1.8.14