12 #ifndef MLPACK_METHODS_CF_AVERAGE_INTERPOLATION_HPP 13 #define MLPACK_METHODS_CF_AVERAGE_INTERPOLATION_HPP 63 template <
typename VectorType,
64 typename DecompositionPolicy>
66 const DecompositionPolicy& ,
68 const arma::Col<size_t>& neighbors,
72 if (neighbors.n_elem == 0)
74 Log::Fatal <<
"Require: neighbors.n_elem > 0. There should be at " 75 <<
"least one neighbor!" << std::endl;
78 if (weights.n_elem != neighbors.n_elem)
80 Log::Fatal <<
"The size of the first parameter (weights) should " 81 <<
"be set to the number of neighbors before calling GetWeights()." 85 weights.fill(1.0 / neighbors.n_elem);
AverageInterpolation(const arma::sp_mat &)
This constructor is needed for interface consistency.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
This class performs average interpolation to generate interpolation weights for neighborhood-based co...
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
void GetWeights(VectorType &&weights, const DecompositionPolicy &, const size_t, const arma::Col< size_t > &neighbors, const arma::vec &, const arma::sp_mat &)
Interoplation weights are identical and sum up to one.