fuzzyclust.preprocessing.normalize#

fuzzyclust.preprocessing.normalize(X, method='var')[source]#

Scale the data and return the scaler for inverse transformation.

Parameters:
Xarray_like of shape (n_samples, n_features)
method{“var”, “range”}, default=”var”

"var": zero mean and unit variance per feature (\(\tilde{x}_{kj} = (x_{kj}-\bar{x}_j)/\sigma_j\)); "range": linear scaling of every feature to \([0, 1]\).

Returns:
X_scaledndarray or DataFrame (same type as the input)
scalerfitted scikit-learn scaler

scaler.inverse_transform undoes the operation (MATLAB clust_denormalize).

Examples

>>> import numpy as np
>>> from fuzzyclust.preprocessing import normalize
>>> X = np.array([[1.0, 10.0], [2.0, 20.0], [3.0, 30.0]])
>>> Xs, scaler = normalize(X, "range")
>>> Xs.min(axis=0), Xs.max(axis=0)
(array([0., 0.]), array([1., 1.]))

Examples using fuzzyclust.preprocessing.normalize#

Feature scaling on real data: the motorcycle data set

Feature scaling on real data: the motorcycle data set