Weighted Nearest Neighbour Imputation.
More...
#include <yat/utility/WeNNI.h>
|
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 |
|
Weighted Nearest Neighbour Imputation.
WeNNI is a continuous weights generalization of the (binary weights) kNNI algorithm presented by Troyanskaya et al. A reference to this paper is found in the NNI document referred to in the NNI class documentation. The NNI document also describes WeNNI in depth.
- Note
- Missing values should be represented with a zero weight. WeNNI will treat the corresponding data values as zero, i.e., this implies that NaNs and Infs with zero weight will not have any impact on calculations.a
- See also
- NNI and kNNI
◆ WeNNI()
theplu::yat::utility::WeNNI::WeNNI |
( |
const MatrixBase & |
matrix, |
|
|
const MatrixBase & |
weight, |
|
|
const unsigned int |
neighbours |
|
) |
| |
◆ calculate_distances()
std::vector<std::pair<size_t,double> > theplu::yat::utility::NNI::calculate_distances |
( |
const size_t |
| ) |
const |
|
protectedinherited |
where C is the number of columns
◆ estimate()
unsigned int theplu::yat::utility::WeNNI::estimate |
( |
void |
| ) |
|
|
virtual |
Function doing WeNNI imputation.
Perform WeNNI on data in matrix with continuous uncertainty weights in weight using neighbours for the new impute value.
The return value can be used as an indication of how well the imputation worked. The return value should be zero if proper pre-processing of data is done. An example of bad data is a matrix with a column of zero weights, another is a corresponding situation with a row with all weights zero.
- Returns
- The number of rows that have at least one value not imputed.
Implements theplu::yat::utility::NNI.
◆ imputed_data()
const utility::Matrix& theplu::yat::utility::NNI::imputed_data |
( |
void |
| ) |
const |
|
inherited |
- Returns
- A const reference to the modified data.
◆ imputed_data_raw()
const Matrix& theplu::yat::utility::WeNNI::imputed_data_raw |
( |
void |
| ) |
const |
- Returns
- A const reference to imputed_data_raw.
◆ nearest_neighbours()
std::vector<size_t> theplu::yat::utility::NNI::nearest_neighbours |
( |
const size_t |
, |
|
|
const std::vector< std::pair< size_t, double > > & |
|
|
) |
| const |
|
protectedinherited |
Contributing nearest neighbours are added up to the user set number, and neighbours are disqualified if their element (column) weight is zero
◆ not_imputed()
const std::vector<size_t>& theplu::yat::utility::NNI::not_imputed |
( |
void |
| ) |
const |
|
inherited |
- Returns
- indices of rows in data matrix not imputed
◆ data_
◆ imputed_data_
◆ neighbours_
unsigned int theplu::yat::utility::NNI::neighbours_ |
|
protectedinherited |
number of neighbor to use
◆ not_imputed_
std::vector<size_t> theplu::yat::utility::NNI::not_imputed_ |
|
protectedinherited |
which rows are not imputed due to lack of data
◆ weight_
The documentation for this class was generated from the following file: