Feature Scalers
- class derrom.scalers.data_scaler[source]
Bases:
objectBase clase to define the methods to be implemented.
- class derrom.scalers.normalize_scaler(rel_scale=1.0)[source]
Bases:
data_scalerFeature scaler which linearly maps each feature to a specified symmetric range around the origin.
- Parameters:
rel_scale (float) – Range to which the features are mapped. The default rel_scale = 1.0 maps to \([-0.5,0.5]\)
- inverse_transform(data_matrix)[source]
Reverses normalization of each feature
- Parameters:
data_matrix (2D numpy.ndarray) – scaled data matrix with the datavectors as rows.
- Returns:
scaled_data_matrix – unscaled data matrix
- Return type:
2D numpy.ndarray
- train(data_matrix)[source]
Determines the range if each feature, i.e., the maximum and minimum value.
Detects quasi-constant features, i.e. features with a standard deviation < 1e-8 and does not scale them.
- Parameters:
data_matrix (2D numpy.ndarray) – Training data matrix, where the data vectors are stored in the rows (first index). Hence, the features are defined by their column index (second index).
- class derrom.scalers.standardize_scaler(rel_scale=1.0)[source]
Bases:
data_scalerFeature scaler which subtracts the mean and devices by the standard deviation for each feature.
- Parameters:
rel_scale (float) – Standard deviation of the resulting scaled features. Default is 1.
- inverse_transform(data_matrix)[source]
Reverses standardization of each feature by multiplying by the standard deviation and adding the mean (of the training data)
- Parameters:
data_matrix (2D numpy.ndarray) – scaled data matrix with the datavectors as rows.
- Returns:
scaled_data_matrix – unscaled data matrix
- Return type:
2D numpy.ndarray
- train(data_matrix)[source]
Computes the mean and standard deviation of each feature.
Detects quasi-constant features, i.e. features with a standard deviation < 1e-8 and does not scale them.
- Parameters:
data_matrix (2D numpy.ndarray) – Training data matrix, where the data vectors are stored in the rows (first index). Hence, the features are defined by their column index (second index).