StandardNormalVariate#

class chemotools.scatter.StandardNormalVariate[源代码]

基类:TransformerMixin, OneToOneFeatureMixin, BaseEstimator

A transformer that calculates the standard normal variate of the input data.

变量:

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

抛出:

UserWarning -- If the standard deviation of a spectrum is zero (spectrum is flat), a warning is raised indicating that the result will contain NaNs.

引用

[1] Åsmund Rinnan, Frans van den Berg, Søren Balling Engelsen,

"Review of the most common pre-processing techniques for near-infrared spectra," TrAC Trends in Analytical Chemistry 28 (10) 1201-1222 (2009).

示例

>>> from chemotools.datasets import load_fermentation_train
>>> from chemotools.scatter import StandardNormalVariate
>>> # Load sample data
>>> X, _ = load_fermentation_train()
>>> # Initialize StandardNormalVariate
>>> snv = StandardNormalVariate()
StandardNormalVariate()
>>> # Fit and transform the data
>>> X_scaled = snv.fit_transform(X)
fit(X: ndarray, y=None) StandardNormalVariate[源代码]

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.

返回类型:

StandardNormalVariate

transform(X: ndarray, y=None) ndarray[源代码]

Transform the input data by calculating the standard normal variate.

参数:
  • 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)