MinMaxScaler Class Reference

A simple MinMax Scaler class. More...

Public Member Functions

 MinMaxScaler (const double min=0, const double max=1)
 Default constructor. More...

 
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 & ItemMin () const
 Get the Min row vector. More...

 
const arma::vec & Scale () const
 Get the Scale row vector. More...

 
double ScaleMax () const
 Get the upper range parameter. More...

 
double ScaleMin () const
 Get the lower range parameter. 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 MinMax Scaler class.

Given an input dataset this class helps you to scale each feature to a given range.

[z = scale * x + scaleMin - min(x) * scale] [scale = (scaleMax - scaleMin) / (max(x) - min(x))]

where scaleMin, scaleMax = feature_range and min(x), max(x) are the minimum and maximum value of x respectively.

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

Definition at line 48 of file min_max_scaler.hpp.

Constructor & Destructor Documentation

◆ MinMaxScaler()

MinMaxScaler ( const double  min = 0,
const double  max = 1 
)
inline

Default constructor.

Parameters
minLower range of scaling.
maxUpper range of scaling.

Definition at line 57 of file min_max_scaler.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 74 of file min_max_scaler.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 113 of file min_max_scaler.hpp.

◆ ItemMax()

const arma::vec& ItemMax ( ) const
inline

Get the Max row vector.

Definition at line 122 of file min_max_scaler.hpp.

◆ ItemMin()

const arma::vec& ItemMin ( ) const
inline

Get the Min row vector.

Definition at line 120 of file min_max_scaler.hpp.

◆ Scale()

const arma::vec& Scale ( ) const
inline

Get the Scale row vector.

Definition at line 124 of file min_max_scaler.hpp.

◆ ScaleMax()

double ScaleMax ( ) const
inline

Get the upper range parameter.

Definition at line 126 of file min_max_scaler.hpp.

◆ ScaleMin()

double ScaleMin ( ) const
inline

Get the lower range parameter.

Definition at line 128 of file min_max_scaler.hpp.

◆ serialize()

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

Definition at line 131 of file min_max_scaler.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 95 of file min_max_scaler.hpp.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.3.2/src/mlpack/core/data/scaler_methods/min_max_scaler.hpp