StandardNormalVariate#
- class chemotools.scatter.StandardNormalVariate[source]
Bases:
TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA transformer that calculates the standard normal variate of the input data.
- Variables:
n_features_in (int) – The number of features in the training data.
- Raises:
UserWarning – If the standard deviation of a spectrum is zero (spectrum is flat), a warning is raised indicating that the result will contain NaNs.
References
- [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).
Examples
>>> 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[source]
Fit the transformer to the input data.
- Parameters:
X (np.ndarray of shape (n_samples, n_features)) – The input data to fit the transformer to.
y (None) – Ignored to align with API.
- Returns:
self – The fitted transformer.
- Return type:
StandardNormalVariate
- transform(X: ndarray, y=None) ndarray[source]
Transform the input data by calculating the standard normal variate.
- Parameters:
X (np.ndarray of shape (n_samples, n_features)) – The input data to transform.
y (None) – Ignored to align with API.
- Returns:
X_transformed – The transformed data.
- Return type:
np.ndarray of shape (n_samples, n_features)