BandDepth#

class skfda.exploratory.depth.BandDepth[source]#

Implementation of Band Depth for functional data.

The band depth of each sample is obtained by computing the fraction of the bands determined by two sample curves containing the whole graph of the first one. In the case the fdatagrid domain dimension is 2, instead of curves, surfaces determine the bands. In larger dimensions, the hyperplanes determine the bands.

Examples

>>> 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)
>>> depth = skfda.exploratory.depth.BandDepth()
>>> depth(fd)
array([ 0.5       ,  0.83333333,  0.5       ,  0.5       ])

References

López-Pintado, S., & Romo, J. (2009). On the Concept of Depth for Functional Data. Journal of the American Statistical Association, 104(486), 718–734. https://doi.org/10.1198/jasa.2009.0108

Methods

fit(X[, y])

Learn the distribution from the observations.

fit_transform(X[, y])

Compute the depth or outlyingness of each observation.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Compute the depth or outlyingness inside the learned distribution.

fit(X, y=None)[source]#

Learn the distribution from the observations.

Parameters:
  • X (FDataGrid) – Functional dataset from which the distribution of the data is inferred.

  • y (object) – Unused. Kept only for convention.

Returns:

Fitted estimator.

Return type:

BandDepth

fit_transform(X, y=None)[source]#

Compute the depth or outlyingness of each observation.

This computation is done with respect to the whole dataset.

Parameters:
  • X (Input) – Dataset.

  • y (object) – Unused. Kept only for convention.

Returns:

Depth of each observation.

Return type:

ndarray[Any, dtype[float64]]

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.

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_output(*, transform=None)#

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters:

transform ({"default", "pandas"}, default=None) –

Configure output of transform and fit_transform.

  • ”default”: Default output format of a transformer

  • ”pandas”: DataFrame output

  • ”polars”: Polars output

  • None: Transform configuration is unchanged

New in version 1.4: “polars” option was added.

Returns:

self – Estimator instance.

Return type:

estimator instance

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)[source]#

Compute the depth or outlyingness inside the learned distribution.

Parameters:

X (FDataGrid) – Points whose depth is going to be evaluated.

Returns:

Depth of each observation.

Return type:

ndarray[Any, dtype[float64]]