MinMaxScaler#

class chemotools.scale.MinMaxScaler(use_min: bool = True)[ソース]

ベースクラス: TransformerMixin, OneToOneFeatureMixin, BaseEstimator

A transformer that scales the input data by subtracting the minimum and dividing by the difference between the maximum and the minimum. When the use_min parameter is False, the data is scaled by the maximum.

パラメータ:

use_min (bool, default=True) -- The normalization to use. If True, the data is subtracted by the minimum and scaled by the maximum. If False, the data is scaled by the maximum.

変数:

n_features_in (int) -- The number of features in the input data.

サンプル

>>> from chemotools.datasets import load_fermentation_train
>>> from chemotools.scale import MinMaxScaler
>>> # Load sample data
>>> X, _ = load_fermentation_train()
>>> # Initialize MinMaxScaler
>>> scaler = MinMaxScaler()
MinMaxScaler()
>>> # Fit and transform the data
>>> X_scaled = scaler.fit_transform(X)
fit(X: ndarray, y=None) MinMaxScaler[ソース]

Fit the transformer to the input data.

パラメータ:
  • X (np.ndarray of shape (n_samples, n_features)) -- The input data to fit the transformer to.

  • y (None) -- Ignored to align with API.

戻り値:

self -- The fitted transformer.

戻り値の型:

MinMaxScaler

transform(X: ndarray, y=None) ndarray[ソース]

Transform the input data by scaling it.

パラメータ:
  • X (np.ndarray of shape (n_samples, n_features)) -- The input data to transform.

  • y (None) -- Ignored to align with API.

戻り値:

X_transformed -- The transformed data.

戻り値の型:

np.ndarray of shape (n_samples, n_features)