Dakota  Version 6.20
Explore and Predict with Confidence
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
DataScaler Class Reference

The DataScaler class computes the scaling coefficients and scales a 2D data matrix with dimensions num_samples by num_features. More...

Inheritance diagram for DataScaler:
NormalizationScaler NoScaler StandardizationScaler

Public Types

enum  SCALER_TYPE { NONE, STANDARDIZATION, MEAN_NORMALIZATION, MINMAX_NORMALIZATION }
 Enumeration for supported types of DataScalers.
 

Public Member Functions

void scale_samples (const MatrixXd &unscaled_samples, MatrixXd &scaled_samples)
 Apply scaling to a set of unscaled samples. More...
 
MatrixXd scale_samples (const MatrixXd &unscaled_samples)
 Apply scaling to a set of unscaled samples. More...
 
const VectorXdget_scaler_features_offsets () const
 Get the vector of offsets. More...
 
const VectorXdget_scaler_features_scale_factors () const
 Get the vector of scaling factors. More...
 
bool check_for_zero_scaler_factor (int index)
 Checks an individual scaler feature scale factor for being close to zero; If it is near zero, we can potentially run into a divide-by-zero error if not handled appropriately. More...
 

Static Public Member Functions

static SCALER_TYPE scaler_type (const std::string &scaler_name)
 Convert scaler name to enum type. More...
 

Protected Attributes

bool hasScaling
 Bool for whether or not the the scaling coefficients have been computed.
 
RowVectorXd scaledSample
 Vector for a single scaled sample - (num_features); avoids resize memory allocs.
 
VectorXd scalerFeaturesOffsets
 Vector of offsets - (num_features)
 
VectorXd scalerFeaturesScaleFactors
 Vector of scaling factors - (num_features)
 

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 Serializer for base class data (call from dervied with base_object)
 

Friends

class boost::serialization::access
 Allow serializers access to private class data.
 

Detailed Description

The DataScaler class computes the scaling coefficients and scales a 2D data matrix with dimensions num_samples by num_features.

There are currently 3 scaling options for the DataScaler class:

  1. StandardizationScaler - transform each feature to have zero mean and unit variance.
  2. NormalizationScaler - normalizies each feature uses the max and min value divided by either the mean value (mean_normalization = true) or min value (mean_normalization = false) Also allows for a norm_factor scaling, required for the direct neural network.
  3. NoScaler - scaling coefficients amount to an identity operation

Member Function Documentation

◆ scale_samples() [1/2]

void scale_samples ( const MatrixXd unscaled_samples,
MatrixXd scaled_samples 
)

◆ scale_samples() [2/2]

MatrixXd scale_samples ( const MatrixXd unscaled_samples)
inline

Apply scaling to a set of unscaled samples.

Parameters
[in]unscaled_samplesUnscaled matrix of samples
Returns
MatrixXd scaled_samples Scaled matrix of samples

References DataScaler::scale_samples().

◆ get_scaler_features_offsets()

const VectorXd& get_scaler_features_offsets ( ) const
inline

Get the vector of offsets.

Returns
Vector of scaler offsets - (num_features)

References DataScaler::scalerFeaturesOffsets.

◆ get_scaler_features_scale_factors()

const VectorXd& get_scaler_features_scale_factors ( ) const
inline

Get the vector of scaling factors.

Returns
Vector of scaling factors - (num_features)

References DataScaler::scalerFeaturesScaleFactors.

Referenced by dakota::surrogates::fd_check_gradient(), and dakota::surrogates::fd_check_hessian().

◆ check_for_zero_scaler_factor()

bool check_for_zero_scaler_factor ( int  index)

Checks an individual scaler feature scale factor for being close to zero; If it is near zero, we can potentially run into a divide-by-zero error if not handled appropriately.

Parameters
[in]indexThe scaler feature index to check
Returns
True if the value is near zero

References dakota::near_zero, and DataScaler::scalerFeaturesScaleFactors.

Referenced by DataScaler::scale_samples().

◆ scaler_type()

SCALER_TYPE scaler_type ( const std::string &  scaler_name)
static

Convert scaler name to enum type.

Parameters
[in]scaler_nameDataScaler name to map
Returns
Corresponding DataScaler enum

References dakota::util::type_name_bimap.

Referenced by GaussianProcess::build(), and PolynomialRegression::build().


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