NormScaler#
- class chemotools.scale.NormScaler(l_norm: int = 2)[ソース]
ベースクラス:
TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA transformer that scales the input data by the L-norm of the spectrum.
- パラメータ:
l_norm (int, optional, default=2) -- The L-norm to use. Default is 2.
- 変数:
n_features_in (int) -- The number of features in the input data.
サンプル
>>> from chemotools.datasets import load_fermentation_train >>> from chemotools.scale import NormScaler >>> # Load sample data >>> X, _ = load_fermentation_train() >>> # Initialize NormScaler >>> scaler = NormScaler(l_norm=2) NormScaler() >>> # Fit and transform the data >>> X_scaled = scaler.fit_transform(X)
- fit(X: ndarray, y=None) NormScaler[ソース]
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.
- 戻り値の型:
NormScaler
- transform(X: ndarray, y=None) ndarray[ソース]
Transform the input data by scaling by the L-norm.
- パラメータ:
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)