BoxplotOutlierDetector#
- class skfda.exploratory.outliers.BoxplotOutlierDetector(*, depth_method=None, factor=1.5)[source]#
Outlier detector using the interquartile range.
Detects as outliers functions that have one or more points outside
factor
times the interquartile range plus or minus the central envelope, given a functional depth measure. This corresponds to the points selected as outliers by the functional boxplot.- Parameters:
depth_method (Callable) – The functional depth measure used.
factor (float) – The number of times the IQR is multiplied.
Example
Function \(f : \mathbb{R}\longmapsto\mathbb{R}\).
>>> import skfda >>> data_matrix = [[1, 1, 2, 3, 2.5, 2], ... [0.5, 0.5, 1, 2, 1.5, 1], ... [-1, -1, -0.5, 1, 1, 0.5], ... [-0.5, -0.5, -0.5, -1, -1, -1]] >>> grid_points = [0, 2, 4, 6, 8, 10] >>> fd = skfda.FDataGrid(data_matrix, grid_points) >>> out_detector = BoxplotOutlierDetector() >>> out_detector.fit_predict(fd) array([-1, 1, 1, -1])
Methods
fit
(X[, y])fit_predict
(X[, y])Perform fit on X and returns labels for X.
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
predict
(X)set_params
(**params)Set the parameters of this estimator.
- fit_predict(X, y=None)[source]#
Perform fit on X and returns labels for X.
Returns -1 for outliers and 1 for inliers.
- Parameters:
X ({array-like, sparse matrix} of shape (n_samples, n_features)) – The input samples.
y (Ignored) – Not used, present for API consistency by convention.
**kwargs (dict) –
Arguments to be passed to
fit
.New in version 1.4.
- Returns:
y – 1 for inliers, -1 for outliers.
- Return type:
ndarray of shape (n_samples,)
- get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
routing – A
MetadataRequest
encapsulating routing information.- Return type:
MetadataRequest
- get_params(deep=True)#
Get parameters for this estimator.
- 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