dcase_models.data.Scaler¶
-
class
dcase_models.data.Scaler(normalizer='standard')[source]¶ Bases:
objectScaler object to normalize or scale the data.
Parameters: - normalizer : {‘standard’ or ‘minmax’}, default=’standard’
Type of normalizer.
See also
DataGenerator- data generator class
Examples
>>> from dcase_models.data.scaler import Scaler >>> import numpy as np >>> scaler = Scaler('minmax') >>> X = 3 * np.random.rand(10, 150) >>> print(np.amin(X), np.amax(X))
>>> scaler.fit(X) >>> X = scaler.transform(X) >>> print(np.amin(X), np.amax(X))
Attributes: - scaler : sklearn.preprocessing.StandardScaler or list
Scaler object for standard normalizer or list for minmax scaler.
-
__init__(normalizer='standard')[source]¶ Initialize the Scaler.
If normalizer is ‘standard’, initialize the sklearn object.
Methods
__init__([normalizer])Initialize the Scaler. fit(X[, inputs])Fit the Scaler. inverse_transform(X)Invert transformation. partial_fit(X)Fit the Scaler in one batch. transform(X)Scale X using the scaler. -
fit(X, inputs=True)[source]¶ Fit the Scaler.
Parameters: - X : ndarray or DataGenerator
Data to be used in the fitting process.
-
inverse_transform(X)[source]¶ Invert transformation.
Parameters: - X : ndarray
Data to be scaled.
Returns: - ndarray
Scaled data. The shape of the output is the same of the input.