CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::scaler::MinMaxScaler Class Reference

Linearly scales features to a target bounding box range. More...

#include <scaler.h>

Inheritance diagram for cmp::scaler::MinMaxScaler:
Collaboration diagram for cmp::scaler::MinMaxScaler:

Public Member Functions

 MinMaxScaler ()=default
 Default constructor.
 
 MinMaxScaler (const Eigen::Ref< const Eigen::VectorXd > &min, const Eigen::Ref< const Eigen::VectorXd > &max)
 Constructs a MinMaxScaler bounded to a specific target range.
 
 MinMaxScaler (const MinMaxScaler &other)=default
 
 MinMaxScaler (MinMaxScaler &&other)=default
 
 ~MinMaxScaler ()=default
 
MinMaxScaleroperator= (const MinMaxScaler &other)=default
 
MinMaxScaleroperator= (MinMaxScaler &&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 getDataMin () const
 Retrieves the empirical minimum vector \( \mathbf{x}_{\text{min}} \) found during fitting.
 
Eigen::VectorXd getDataMax () const
 Retrieves the empirical maximum vector \( \mathbf{x}_{\text{max}} \) found during fitting.
 
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.
 
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.
 

Private Attributes

Eigen::VectorXd min_
 Target minimum value bounding vector \( \mathbf{a} \).
 
Eigen::VectorXd max_
 Target maximum value bounding vector \( \mathbf{b} \).
 
Eigen::VectorXd data_min_
 Empirical minimum value vector \( \mathbf{x}_{\text{min}} \) observed in the training dataset.
 
Eigen::VectorXd data_max_
 Empirical maximum value vector \( \mathbf{x}_{\text{max}} \) observed in the training dataset.
 

Detailed Description

Linearly scales features to a target bounding box range.

Mathematical Formulation

Scales each feature vector component to live within a target range \([a_j, b_j]\) (typically \([0, 1]\)):

\[ y_j = a_j + \frac{x_j - x_{\text{min}, j}}{x_{\text{max}, j} - x_{\text{min}, j}} (b_j - a_j) \]

where \(x_{\text{min}, j}\) and \(x_{\text{max}, j}\) are the training data's empirical minimum and maximum values for feature \(j\).

  • ### Implementation Algorithm
  1. fit() computes column-wise minima and maxima vectors of the training matrix.
  2. transform() and inverseTransform() apply element-wise division and scaling multiplication.

Constructor & Destructor Documentation

◆ MinMaxScaler() [1/4]

cmp::scaler::MinMaxScaler::MinMaxScaler ( )
default

Default constructor.

◆ MinMaxScaler() [2/4]

cmp::scaler::MinMaxScaler::MinMaxScaler ( const Eigen::Ref< const Eigen::VectorXd > &  min,
const Eigen::Ref< const Eigen::VectorXd > &  max 
)
inline

Constructs a MinMaxScaler bounded to a specific target range.

Parameters
minThe target minimum bounding vector \( \mathbf{a} \).
maxThe target maximum bounding vector \( \mathbf{b} \).

◆ MinMaxScaler() [3/4]

cmp::scaler::MinMaxScaler::MinMaxScaler ( const MinMaxScaler other)
default

◆ MinMaxScaler() [4/4]

cmp::scaler::MinMaxScaler::MinMaxScaler ( MinMaxScaler &&  other)
default

◆ ~MinMaxScaler()

cmp::scaler::MinMaxScaler::~MinMaxScaler ( )
default

Member Function Documentation

◆ fit()

void cmp::scaler::MinMaxScaler::fit ( const Eigen::Ref< const Eigen::MatrixXd > &  data)
overridevirtual

Learns the scaling parameters (e.g., mean, variance) from the training data.

Parameters
dataA matrix \( X \in \mathbb{R}^{n \times d} \) of training samples.

Implements cmp::scaler::Scaler.

◆ fit_transform()

Eigen::MatrixXd cmp::scaler::MinMaxScaler::fit_transform ( const Eigen::Ref< const Eigen::MatrixXd > &  data)
overridevirtual

Fits the scaling parameters to the data and subsequently transforms the data.

Parameters
dataA matrix \( X \in \mathbb{R}^{n \times d} \) of training samples.
Returns
The transformed dataset matrix \( Y \).

Implements cmp::scaler::Scaler.

◆ getDataMax()

Eigen::VectorXd cmp::scaler::MinMaxScaler::getDataMax ( ) const
inline

Retrieves the empirical maximum vector \( \mathbf{x}_{\text{max}} \) found during fitting.

Returns
The maximum data vector.

◆ getDataMin()

Eigen::VectorXd cmp::scaler::MinMaxScaler::getDataMin ( ) const
inline

Retrieves the empirical minimum vector \( \mathbf{x}_{\text{min}} \) found during fitting.

Returns
The minimum data vector.

◆ getIntercept()

Eigen::VectorXd cmp::scaler::MinMaxScaler::getIntercept ( ) const
overridevirtual

Retrieves the intercept vector \( \mu \) used in the transformation.

Returns
The intercept vector.

Implements cmp::scaler::Scaler.

◆ getScale()

Eigen::MatrixXd cmp::scaler::MinMaxScaler::getScale ( ) const
overridevirtual

Retrieves the scaling matrix \( S \) used in the transformation.

Returns
The scaling matrix.

Implements cmp::scaler::Scaler.

◆ inverseTransform()

Eigen::VectorXd cmp::scaler::MinMaxScaler::inverseTransform ( const Eigen::Ref< const Eigen::VectorXd > &  data) const
overridevirtual

Reconstructs the data from the scaled latent space back to physical space.

Parameters
dataA column vector \( y \) in the scaled space.
Returns
The unscaled physical data vector \( x \).

Implements cmp::scaler::Scaler.

◆ operator=() [1/2]

MinMaxScaler & cmp::scaler::MinMaxScaler::operator= ( const MinMaxScaler other)
default

◆ operator=() [2/2]

MinMaxScaler & cmp::scaler::MinMaxScaler::operator= ( MinMaxScaler &&  other)
default

◆ transform()

Eigen::VectorXd cmp::scaler::MinMaxScaler::transform ( const Eigen::Ref< const Eigen::VectorXd > &  data) const
overridevirtual

Transforms the input data from physical space to the scaled latent space.

Parameters
dataA column vector \( x \) representing a single data point in physical space.
Returns
The scaled data vector \( y \).

Implements cmp::scaler::Scaler.

Member Data Documentation

◆ data_max_

Eigen::VectorXd cmp::scaler::MinMaxScaler::data_max_
private

Empirical maximum value vector \( \mathbf{x}_{\text{max}} \) observed in the training dataset.

◆ data_min_

Eigen::VectorXd cmp::scaler::MinMaxScaler::data_min_
private

Empirical minimum value vector \( \mathbf{x}_{\text{min}} \) observed in the training dataset.

◆ max_

Eigen::VectorXd cmp::scaler::MinMaxScaler::max_
private

Target maximum value bounding vector \( \mathbf{b} \).

◆ min_

Eigen::VectorXd cmp::scaler::MinMaxScaler::min_
private

Target minimum value bounding vector \( \mathbf{a} \).


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