12 #ifndef MLPACK_CORE_DATA_MAX_ABS_SCALE_HPP    13 #define MLPACK_CORE_DATA_MAX_ABS_SCALE_HPP    54   template<
typename MatType>
    55   void Fit(
const MatType& input)
    57     itemMin = arma::min(input, 1);
    58     itemMax = arma::max(input, 1);
    59     scale = arma::max(arma::abs(itemMin), arma::abs(itemMax));
    61     scale.for_each([](arma::vec::elem_type& val) { val =
    62         (val == 0) ? 1 : val; });
    71   template<
typename MatType>
    72   void Transform(
const MatType& input, MatType& output)
    76       throw std::runtime_error(
"Call Fit() before Transform(), please"    77         " refer to the documentation.");
    79     output.copy_size(input);
    80     output = input.each_col() / scale;
    89   template<
typename MatType>
    92     output.copy_size(input);
    93     output = input.each_col() % scale;
    97   const arma::vec& 
ItemMin()
 const { 
return itemMin; }
    99   const arma::vec& 
ItemMax()
 const { 
return itemMax; }
   101   const arma::vec& 
Scale()
 const { 
return scale; }
   103   template<
typename Archive>
   106     ar(CEREAL_NVP(itemMin));
   107     ar(CEREAL_NVP(itemMax));
   108     ar(CEREAL_NVP(scale));
 const arma::vec & ItemMax() const
Get the Max row vector. 
 
Linear algebra utility functions, generally performed on matrices or vectors. 
 
The core includes that mlpack expects; standard C++ includes and Armadillo. 
 
void Transform(const MatType &input, MatType &output)
Function to scale features. 
 
void serialize(Archive &ar, const uint32_t)
 
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset. 
 
const arma::vec & Scale() const
Get the Scale row vector. 
 
A simple MaxAbs Scaler class. 
 
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale. 
 
const arma::vec & ItemMin() const
Get the Min row vector.