LinearCorrection#
- class chemotools.baseline.LinearCorrection[fuente]
Bases:
TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA transformer that corrects a baseline by subtracting a linear baseline through the initial and final points of the spectrum.
- Variables:
n_features_in (int) – The number of features in the input data.
Ejemplos
>>> from chemotools.baseline import LinearCorrection >>> from chemotools.datasets import load_fermentation_train >>> # Load sample data >>> X, _ = load_fermentation_train() >>> # Instantiate the transformer >>> transformer = LinearCorrection() LinearCorrection() >>> transformer.fit(X) >>> # Generate baseline-corrected data >>> X_corrected = transformer.transform(X)
- fit(X: ndarray, y=None) LinearCorrection[fuente]
Fit the transformer to the input data.
- Parámetros:
X (np.ndarray of shape (n_samples, n_features)) – The input data to fit the transformer to.
y (None) – Ignored to align with API.
- Devuelve:
self – The fitted transformer.
- Tipo del valor devuelto:
LinearCorrection
- transform(X: ndarray, y=None) ndarray[fuente]
Transform the input data by subtracting the constant baseline value.
- Parámetros:
X (np.ndarray of shape (n_samples, n_features)) – The input data to transform.
y (None) – Ignored to align with API.
- Devuelve:
X_transformed – The transformed data.
- Tipo del valor devuelto:
np.ndarray of shape (n_samples, n_features)