MedianFilter#
- class chemotools.smooth.MedianFilter(window_length: int = 3, mode: Literal['reflect', 'constant', 'nearest', 'mirror', 'wrap', 'grid-constant', 'grid-mirror', 'grid-wrap'] = 'nearest', window_size='deprecated')[ソース]
ベースクラス:
TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA smoothing transformer that calculates the median filter of the input data.
- パラメータ:
window_length (int, optional, default=3) -- The size of the window to use for the median filter. Must be odd. Default is 3.
mode (str, optional, default="nearest") -- The mode to use for the median filter. Can be "nearest", "constant", "reflect", "wrap", "mirror" or "interp". Default is "nearest".
window_size (int, optional) -- Deprecated alias for
window_length.
- 変数:
n_features_in (int) -- The number of features in the training data.
サンプル
>>> from chemotools.datasets import load_fermentation_train >>> from chemotools.smooth import MedianFilter >>> # Load sample data >>> X, _ = load_fermentation_train() >>> # Initialize MedianFilter >>> md = MedianFilter() MedianFilter() >>> # Fit and transform the data >>> X_smoothed = md.fit_transform(X)
- fit(X: ndarray, y=None) MedianFilter[ソース]
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.
- 戻り値の型:
MedianFilter
- transform(X: ndarray, y=None) ndarray[ソース]
Transform the input data by calculating the median filter.
- パラメータ:
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)