12#ifndef MLPACK_CORE_DATA_IMPUTE_STRATEGIES_LISTWISE_DELETION_HPP
13#define MLPACK_CORE_DATA_IMPUTE_STRATEGIES_LISTWISE_DELETION_HPP
39 const size_t dimension,
40 const bool columnMajor =
true)
42 std::vector<arma::uword> colsToKeep;
46 for (
size_t i = 0; i < input.n_cols; ++i)
48 if (!(input(dimension, i) == mappedValue ||
49 std::isnan(input(dimension, i))))
51 colsToKeep.push_back(i);
54 input = input.cols(arma::uvec(colsToKeep));
58 for (
size_t i = 0; i < input.n_rows; ++i)
60 if (!(input(i, dimension) == mappedValue ||
61 std::isnan(input(i, dimension))))
63 colsToKeep.push_back(i);
66 input = input.rows(arma::uvec(colsToKeep));
A complete-case analysis to remove the values containing mappedValue.
void Impute(arma::Mat< T > &input, const T &mappedValue, const size_t dimension, const bool columnMajor=true)
Impute function searches through the input looking for mappedValue and remove the whole row or column...
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.