mlpack 3.4.2
Public Member Functions | List of all members
MeanNormalization Class Reference

A simple Mean Normalization class. More...

#include <mean_normalization.hpp>

Public Member Functions

template<typename MatType >
void Fit (const MatType &input)
 Function to fit features, to find out the min max and scale. More...
 
template<typename MatType >
void InverseTransform (const MatType &input, MatType &output)
 Function to retrieve original dataset. More...
 
const arma::vec & ItemMax () const
 Get the Max row vector. More...
 
const arma::vec & ItemMean () const
 Get the Mean row vector. More...
 
const arma::vec & ItemMin () const
 Get the Min row vector. More...
 
const arma::vec & Scale () const
 Get the Scale row vector. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 
template<typename MatType >
void Transform (const MatType &input, MatType &output)
 Function to scale features. More...
 

Detailed Description

A simple Mean Normalization class.

Given an input dataset this class helps you to normalize each feature.

[z = x - average(x) / (max(x) - min(x))]

where x is an original value,z is the normalized value.

arma::mat input;
Load("train.csv", input);
arma::mat output;
// Fit the features.
MeanNormalization scale;
scale.Fit(input)
// Scale the features.
scale.Transform(input, output);
// Retransform the input.
scale.InverseTransform(output, input);
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true, const arma::file_type inputLoadType=arma::auto_detect)
Loads a matrix from file, guessing the filetype from the extension.

Definition at line 46 of file mean_normalization.hpp.

Member Function Documentation

◆ Fit()

void Fit ( const MatType &  input)
inline

Function to fit features, to find out the min max and scale.

Parameters
inputDataset to fit.

Definition at line 55 of file mean_normalization.hpp.

◆ InverseTransform()

void InverseTransform ( const MatType &  input,
MatType &  output 
)
inline

Function to retrieve original dataset.

Parameters
inputScaled dataset.
outputOutput matrix with original Dataset.

Definition at line 91 of file mean_normalization.hpp.

◆ ItemMax()

const arma::vec & ItemMax ( ) const
inline

Get the Max row vector.

Definition at line 102 of file mean_normalization.hpp.

◆ ItemMean()

const arma::vec & ItemMean ( ) const
inline

Get the Mean row vector.

Definition at line 98 of file mean_normalization.hpp.

◆ ItemMin()

const arma::vec & ItemMin ( ) const
inline

Get the Min row vector.

Definition at line 100 of file mean_normalization.hpp.

◆ Scale()

const arma::vec & Scale ( ) const
inline

Get the Scale row vector.

Definition at line 104 of file mean_normalization.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned int   
)
inline

Definition at line 107 of file mean_normalization.hpp.

◆ Transform()

void Transform ( const MatType &  input,
MatType &  output 
)
inline

Function to scale features.

Parameters
inputDataset to scale features.
outputOutput matrix with scaled features.

Definition at line 73 of file mean_normalization.hpp.


The documentation for this class was generated from the following file: