Transformer
HampelFilter
Use HampelFilter to detect outliers based on a sliding window.
Quickstart
python
from sktime.transformations.outlier_detection import HampelFilter
estimator = HampelFilter(window_length=10, n_sigma=3, k=1.4826, return_bool=False)Parameters(4)
- window_lengthint, optional (default=10)
- Length of the sliding window
- n_sigmaint, optional (default=3)
- Defines how strong a point must outly to be an “outlier”
- kfloat, optional (default = 1.4826)
- A constant scale factor which is dependent on the distribution, for Gaussian it is approximately 1.4826, by default 1.4826
- return_boolbool, optional (default=False)
- If True, outliers are filled with True and non-outliers with False. Else, outliers are filled with np.nan.
Examples
>>> from sktime.transformations.outlier_detection import HampelFilter
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> transformer = HampelFilter (window_length = 10)
>>> y_hat = transformer. fit_transform (y)References
- [1 ] Hampel F. R., “The influence curve and its role in robust estimation”, Journal of the American Statistical Association, 69, 382-393, 1974