NorrisWilliams#
- class chemotools.derivative.NorrisWilliams(window_length: int = 5, gap_size: int = 3, deriv: int = 1, mode='nearest', window_size='deprecated', derivative_order='deprecated')[ソース]
ベースクラス:
TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA transformer that calculates the Norris-Williams derivative of the input data.
- パラメータ:
window_length (int, optional, default=5) -- The size of the window to use for the derivative calculation. Must be odd. Default is 5.
gap_size (int, optional, default=3) -- The size of the gap to use for the derivative calculation. Must be odd. Default is 3.
deriv (int, optional, default=1) -- The order of the derivative to calculate. Can be 1 or 2. Default is 1.
mode (str, optional, default="nearest") -- The mode to use for the derivative calculation. Can be "nearest", "constant", "reflect", "wrap", "mirror" or "interp". Default is "nearest".
window_size (int, optional) -- Deprecated alias for
window_length.derivative_order (int, optional) -- Deprecated alias for
deriv.
- 変数:
n_features_in (int) -- The number of features in the input data.
参照
- [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.derivative import NorrisWilliams >>> from chemotools.datasets import load_fermentation_train >>> # Load sample data >>> X, _ = load_fermentation_train() >>> # Instantiate the transformer >>> transformer = NorrisWilliams(window_size=5, gap_size=3) NorrisWilliams() >>> transformer.fit(X) >>> # Calculate Norris-Williams derivative >>> X_corrected = transformer.transform(X)
- fit(X: ndarray, y=None) NorrisWilliams[ソース]
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.
- 戻り値の型:
NorrisWilliams
- transform(X: ndarray, y=None)[ソース]
Transform the input data by calculating the Norris-Williams derivative.
- パラメータ:
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)