Simplicial depth#
- DepthEucl.simplicial(x: ndarray | None = None, exact: bool = True, k: float = 0.05, evaluate_dataset: bool = False) ndarray [source]
Calculates the simplicial depth of points w.r.t. a multivariate data set.
- Arguments
- x: array-like or None, default=None
Matrix of objects (numerical vector as one object) whose depth is to be calculated; each row contains a d-variate point. Should have the same dimension as data.
- exact: bool, default=True
exact=True
(by default) implies the exact algorithm,exact=False
implies the approximative algorithm, considering k simplices.- kfloat or int, default=0.05
- Number (
k > 1
) or portion (if0 < k < 1
) of simplices that are considered ifexact=False
.Ifk > 1
, then the algorithmic complexity is polynomial in d but is independent of the number of observations in data, given k.If0 < k < 1
,then the algorithmic complexity is exponential in the number of observations in data, but the calculation precision stays approximately the same. - evaluate_datasetbool, default=False
Determines if dataset loaded will be evaluated. Automatically sets x to dataset
- References
Liu , R. Y. (1990). On a notion of data depth based on random simplices. The Annals of Statistics, 18, 405–414.
- Examples
>>> import numpy as np >>> from depth.model import DepthEucl >>> mat1=[[1, 0, 0],[0, 1, 0],[0, 0, 1]] >>> mat2=[[1, 0, 0],[0, 1, 0],[0, 0, 1]] >>> x = np.random.multivariate_normal([1,1,1], mat2, 10) >>> data = np.random.multivariate_normal([0,0,0], mat1, 25) >>> model=DepthEucl().load_dataset(data) >>> model.simplicial(x,) [0.04458498 0. 0. 0. 0. 0. 0. 0. 0. 0. ]