Scaling

This page describes routines that deal with scaling data.


Standardize

Scaling Standardize

Description

Return a matrix that is column-wise centered to mean 0 and scaled to a standard devation 1. More precisely, each original $x$ in a column corresponds to the following transformation: $$ f(x) = \frac{x - \overline{x}}{\sigma} $$ where $\overline{x}$ is the column mean and $\sigma$ is the column standard deviation.

Returns

  • Matrix with the scaled columns

Min-Max

Scaling MinMax

Description

Return a matrix that is column-wise scaled to a lower bound $lb$ and an upper bound $ub$ specified by the user. More precisely, each original $x$ in a column corresponds to the following transformation: $$ f(x) = lb + \frac{(x - min(x)) (ub - lb)}{(max(x) - min(x))} $$

Returns

  • Matrix with the scaled columns

Box-Cox

Scaling BoxCox

Description

Return a matrix that is column-wise scaled using the Box-Cox transform. The transform itself is defined as:

$$ y(\lambda)= \begin{cases} \Large\frac{y^{\lambda} - 1}{\lambda} & \text{ if } \lambda\neq 0 \\log(y) &\text{ if } \lambda = 0 \end{cases} $$

An optimization routine is used to find the parameter $ \lambda $ maximizing the log-likelihood function for the Box-Cox transform.

Returns

  • $ \lambda $ for each column
  • Matrix with the scaled columns

Yeo-Johnson

Scaling YeoJohnson

Description

Return a matrix that is column-wise scaled using the Yeo-Johnson transform. The transform itself is defined as:

$$ y(\lambda)= \begin{cases} \frac{(y+1)^{\lambda} - 1}{\lambda} &\text{ if } \lambda\neq 0, y \geq 0 \\log(y+1) &\text{ if } \lambda = 0, y \geq 0 \\\frac{(1-y)^{2-\lambda} - 1}{\lambda-2} &\text{ if } \lambda\neq 2, y \lt 0 \\-log(1-y) &\text{ if } \lambda = 2, y \lt 0 \end{cases} $$

An optimization routine is used to find the parameter $ \lambda $ maximizing the log-likelihood function for the Yeo-Johnson transform.

Returns

  • $ \lambda $ for each column
  • Matrix with the scaled columns