#include <yat/utility/kNNI.h>
Public Member Functions | |
kNNI (const utility::Matrix &matrix, const utility::Matrix &weight, const unsigned int neighbours) | |
unsigned int | estimate (void) |
Function doing kNNI imputation. | |
const utility::Matrix & | imputed_data (void) const |
const std::vector< size_t > & | not_imputed (void) const |
Protected Member Functions | |
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 |
Protected Attributes | |
const utility::Matrix & | data_ |
utility::Matrix | imputed_data_ |
unsigned int | neighbours_ |
std::vector< size_t > | not_imputed_ |
const utility::Matrix & | weight_ |
kNNI is the binary weight implementation of NNI. This follows the work done by Troyanskaya et al. cited in the NNI document referred to in the NNI class documentation.
This is a special case of the WeNNI, but is maintained since it is faster than the more general WeNNI.
theplu::yat::utility::kNNI::kNNI | ( | const utility::Matrix & | matrix, | |
const utility::Matrix & | weight, | |||
const unsigned int | neighbours | |||
) |
Constructor
std::vector<std::pair<size_t,double> > theplu::yat::utility::NNI::calculate_distances | ( | const | size_t | ) | const [protected, inherited] |
where C is the number of columns
unsigned int theplu::yat::utility::kNNI::estimate | ( | void | ) | [virtual] |
Function doing kNNI imputation.
Perform kNNI on data in matrix with binary 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.
Implements theplu::yat::utility::NNI.
const utility::Matrix& theplu::yat::utility::NNI::imputed_data | ( | void | ) | const [inherited] |
std::vector<size_t> theplu::yat::utility::NNI::nearest_neighbours | ( | const | size_t, | |
const std::vector< std::pair< size_t, double > > & | ||||
) | const [protected, inherited] |
Contributing nearest neighbours are added up to the user set number, and neighbours are disqualified if their element (column) weight is zero
const std::vector<size_t>& theplu::yat::utility::NNI::not_imputed | ( | void | ) | const [inherited] |
const utility::Matrix& theplu::yat::utility::NNI::data_ [protected, inherited] |
original data matrix
utility::Matrix theplu::yat::utility::NNI::imputed_data_ [protected, inherited] |
data after imputation
unsigned int theplu::yat::utility::NNI::neighbours_ [protected, inherited] |
number of neighbor to use
std::vector<size_t> theplu::yat::utility::NNI::not_imputed_ [protected, inherited] |
which rows are not imputed due to lack of data
const utility::Matrix& theplu::yat::utility::NNI::weight_ [protected, inherited] |
weight matrix