mlpack
Public Member Functions | List of all members
mlpack::data::StandardScaler Class Reference

A simple Standard Scaler class. More...

#include <standard_scaler.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 Transform (const MatType &input, MatType &output)
 Function to scale features. More...
 
template<typename MatType >
void InverseTransform (const MatType &input, MatType &output)
 Function to retrieve original dataset. More...
 
const arma::vec & ItemMean () const
 Get the mean row vector.
 
const arma::vec & ItemStdDev () const
 Get the standard deviation row vector.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 

Detailed Description

A simple Standard Scaler class.

Given an input dataset this class helps you to Standardize features by removing the mean and scaling to unit variance.

[z = (x - u) / s]

where u is the mean of the training samples and s is the standard deviation of the training samples.

arma::mat input;
Load("train.csv", input);
arma::mat output;
// Fit the features.
StandardScaler scale;
scale.Fit(input)
// Scale the features.
scale.Transform(input, output);
// Retransform the input.
scale.InverseTransform(output, input);

Member Function Documentation

◆ Fit()

template<typename MatType >
void mlpack::data::StandardScaler::Fit ( const MatType &  input)
inline

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

Parameters
inputDataset to fit.

◆ InverseTransform()

template<typename MatType >
void mlpack::data::StandardScaler::InverseTransform ( const MatType &  input,
MatType &  output 
)
inline

Function to retrieve original dataset.

Parameters
inputScaled dataset.
outputOutput matrix with original Dataset.

◆ Transform()

template<typename MatType >
void mlpack::data::StandardScaler::Transform ( const MatType &  input,
MatType &  output 
)
inline

Function to scale features.

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

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