Standardizes features by removing the mean and scaling to unit variance using Cholesky decomposition.
More...
|
| | StandardScaler ()=default |
| | Default constructor.
|
| |
| | StandardScaler (const Eigen::Ref< const Eigen::VectorXd > &mean, const Eigen::Ref< const Eigen::MatrixXd > &scale) |
| | Constructs a StandardScaler with a pre-computed mean and covariance scale.
|
| |
| | StandardScaler (const StandardScaler &other)=default |
| |
| | StandardScaler (StandardScaler &&other)=default |
| |
| | ~StandardScaler ()=default |
| |
| StandardScaler & | operator= (const StandardScaler &other)=default |
| |
| StandardScaler & | operator= (StandardScaler &&other)=default |
| |
| Eigen::VectorXd | transform (const Eigen::Ref< const Eigen::VectorXd > &data) const override |
| | Transforms the input data from physical space to the scaled latent space.
|
| |
| Eigen::VectorXd | inverseTransform (const Eigen::Ref< const Eigen::VectorXd > &data) const override |
| | Reconstructs the data from the scaled latent space back to physical space.
|
| |
| Eigen::VectorXd | getIntercept () const override |
| | Retrieves the intercept vector \( \mu \) used in the transformation.
|
| |
| Eigen::MatrixXd | getScale () const override |
| | Retrieves the scaling matrix \( S \) used in the transformation.
|
| |
| void | fit (const Eigen::Ref< const Eigen::MatrixXd > &data) override |
| | Learns the scaling parameters (e.g., mean, variance) from the training data.
|
| |
| Eigen::MatrixXd | fit_transform (const Eigen::Ref< const Eigen::MatrixXd > &data) override |
| | Fits the scaling parameters to the data and subsequently transforms the data.
|
| |
Standardizes features by removing the mean and scaling to unit variance using Cholesky decomposition.
Mathematical Formulation
Given data matrix \( X \in \mathbb{R}^{n \times d} \), let \( \mu \in \mathbb{R}^d \) be the column-wise mean and \( \Sigma \in \mathbb{R}^{d \times d} \) be the covariance matrix. We decompose the covariance matrix via the lower Cholesky factor \( L \) such that:
\[ \Sigma = L L^T \]
The transformation maps:
\[ y = L^{-1}(x - \mu) \]
The inverse transformation maps:
\[ x = L y + \mu \]
- ### Implementation Algorithm
- Fit: Calculate mean vector \( \mu \) and covariance matrix \( \Sigma \) of \( X \), then perform Cholesky LLT decomposition to obtain \( L \).
- Transform: Solve the lower triangular system \( L y = x - \mu \) to compute standardized data.
- Inverse Transform: Compute \( L y + \mu \) via matrix multiplication and vector addition.