13 #ifndef MLPACK_CORE_DATA_IMPUTER_HPP 14 #define MLPACK_CORE_DATA_IMPUTER_HPP 32 template<
typename T,
typename MapperType,
typename StrategyType>
36 Imputer(MapperType mapper,
bool columnMajor =
true):
37 mapper(
std::move(mapper)),
38 columnMajor(columnMajor)
43 Imputer(MapperType mapper, StrategyType strategy,
bool columnMajor =
true):
44 strategy(
std::move(strategy)),
45 mapper(
std::move(mapper)),
46 columnMajor(columnMajor)
61 const std::string& missingValue,
62 const size_t dimension)
64 T mappedValue =
static_cast<T
>(mapper.UnmapValue(missingValue, dimension));
65 strategy.Impute(input, mappedValue, dimension, columnMajor);
69 const StrategyType&
Strategy()
const {
return strategy; }
75 const MapperType&
Mapper()
const {
return mapper; }
78 MapperType&
Mapper() {
return mapper; }
82 StrategyType strategy;
const StrategyType & Strategy() const
Get the strategy.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Imputer(MapperType mapper, StrategyType strategy, bool columnMajor=true)
Given a dataset of a particular datatype, replace user-specified missing value with a variable depend...
StrategyType & Strategy()
Modify the given strategy.
void Impute(arma::Mat< T > &input, const std::string &missingValue, const size_t dimension)
Given an input dataset, replace missing values of a dimension with given imputation strategy...
MapperType & Mapper()
Modify the given mapper.
Imputer(MapperType mapper, bool columnMajor=true)
const MapperType & Mapper() const
Get the mapper.