chemometrics.Emsc

class chemometrics.Emsc(p_order=2, background=None, normalize=False, algorithm='als', asym_factor=0.1)

Bases: TransformerMixin, BaseEstimator

Perform extended multiplicative scatter correction (EMSC)

Emsc is a spectral pretreatment which is based on a linear decomposition of data into baseline contributions and chemical information. Baseline contributions are modelled by polynomial terms up to order p_order. The chemical information is summarized by the mean spectrum orthogonalized to the baseline terms. Emsc additionally provides a the functionality for orthogonalizing spectra with respect to background information and for normalizing the returned spectra.

Parameters
  • p_order (int) – Polynoms up to order p_order are included for baseline subtraction.

  • background ({None (default), (m, o) ndarray}) – Perform additional orthogonalization with respect to background. If None omitted. Otherwise, m variables x o background spectra

  • normalize ({False (default), True}) – Perform normalization of results

  • algorithm ({'als' (default)}) – choice of algorithms for regression. Currently, only asymmetric least squares is supported

regressor_

Matrix of regressor variables for background subtraction.

Type

array of floats

coefficients_

Coefficients of last transform.

Type

array of floats

Notes

An introduction to EMSC is given in 1. Asymmetric least squares regression may be looked up at 2.

References

1

Nils Kristian Afseth, Achim Kohler, Extended multiplicative signal correction in vibrational spectroscopy, a tutorial, Chemometrics and Intelligent Laboratory Systems, vol. 117, pp. 92-99, 2012.

2

Hans F.M. Boelens, Reyer J. Dijkstra, Paul H.C. Eilers, Fiona Fitzpatrick, Johan A. Westerhuis, New background correction method for liquid chromatography with diode array detection, infrared spectroscopic detection and Raman spectroscopic detection, J. Chromatogr. A, vol. 1057, pp. 21-30, 2004.

__init__(p_order=2, background=None, normalize=False, algorithm='als', asym_factor=0.1)

Methods

__init__([p_order, background, normalize, ...])

fit(X[, y])

Calculate regression matrix for later use.

fit_transform(X[, y])

Fit to data, then transform it.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

transform(X[, copy])

Perform baseline correction by subtracting fit of regresor on X

fit(X, y=None)

Calculate regression matrix for later use.

Parameters
  • X ((n, m) ndarray) – Data to be pretreated. n samples x m variables (typically wavelengths)

  • y – Ignored

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) – Target values (None for unsupervised transformations).

  • **fit_params (dict) – Additional fit parameters.

Returns

X_new – Transformed array.

Return type

ndarray array of shape (n_samples, n_features_new)

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

dict

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance

transform(X, copy=True)

Perform baseline correction by subtracting fit of regresor on X

Parameters

X (array-like, shape [n_samples, n_features]) – The data used to scale along the features axis.