Depth(-based) visualization#
- depth_mesh(model: DepthEucl, notion: str = 'halfspace', freq: List[int] = [100, 100], xlim: List[int] | None = None, ylim: List[int] | None = None, mah_estimate: str = 'moment', mah_parMCD: float = 0.75, beta: int = 2, distance: str = 'Lp', Lp_p: int = 2, exact: bool = True, method: str = 'recursive', k: float = 0.05, solver: str = 'neldermead', NRandom: int = 1000, n_refinements: int = 10, sphcap_shrink: float = 0.5, alpha_Dirichlet: float = 1.25, cooling_factor: float = 0.95, cap_size: float | int = 1, start: str = 'mean', space: str = 'sphere', line_solver: str = 'goldensection', bound_gc: bool = True) tuple[ndarray, ndarray, ndarray] [source]
Computes the depth mesh
- Parameters
- notion: str, default=”halfspace”
Chosen notion for depth computation. The mesh will be computed using this notion to map the 2D space
- freq: List[int], defaul=[100,100]
Amount of points to map depth in both dimensions.
- xlim: List[int], default=None
Limits for x value computation. If None, value is determined based on dataset values.
- ylim: List[int], default=None
Limits for y value computation. If None, value is determined based on dataset values.
- Results
- xs: np.ndarray
x coordinate for plotting
- ys: np.ndarray
y coordinate for plotting
- depth_grid: np.ndarray
depth values for the grid
- depth_plot2d(model: DepthEucl, notion: str = 'halfspace', freq: list = [100, 100], xlim: List[int] | List[float] = None, ylim: List[int] | List[float] = None, cmap: str = 'YlOrRd', ret_depth_mesh: bool = False, xs=None, ys=None, val_mesh=None, mah_estimate='moment', mah_parMCD=0.75, beta=2, distance='Lp', Lp_p=2, exact=True, method='recursive', k=0.05, solver='neldermead', NRandom=1000, n_refinements=10, sphcap_shrink=0.5, alpha_Dirichlet=1.25, cooling_factor=0.95, cap_size=1, start='mean', space='sphere', line_solver='goldensection', bound_gc=True)[source]
Plots the 2D view of the depth
- Parameters
- model: Euclidean Depth model
Model with loaded dataset
- notion: str, default=”halfspace”
Chosen notion for depth computation. The mesh will be computed using this notion to map the 2D space
- freq: List[int], defaul=[100,100]
Amount of points to map depth in both dimensions.
- xlim: List[int], default=None
Limits for x value computation. If None, value is determined based on dataset values.
- ylim: List[int], default=None
Limits for y value computation. If None, value is determined based on dataset values.
- exactbool, delfaut=True
Whether the depth computation is exact.
- mah_estimatestr, {“moment”, “mcd”}, default=”moment”
Specifying which estimates to use when calculating the depth
- mah_parMcdfloat, default=0.75
Value of the argument alpha for the function covMcd
- solverstr, default=”neldermead”
The type of solver used to approximate the depth.
- NRandomint, default=1000
Total number of directions used for approximate depth
- n_refinementsint, default = 10
Number of iterations used to approximate the depth For
solver='refinedrandom'
or'refinedgrid'
- sphcap_shrinkfloat, default = 0.5
For
solver
=refinedrandom
or refinedgrid, it’s the shrinking of the spherical cap.- alpha_Dirichletfloat, default = 1.25
For
solver
=randomsimplices
. it’s the parameter of the Dirichlet distribution.- cooling_factorfloat, default = 0.95
For
solver
=randomsimplices
, it’s the cooling factor.- cap_sizeint | float, default = 1
For
solver
=simulatedannealing
orneldermead
, it’s the size of the spherical cap.- startstr {‘mean’, ‘random’}, default = mean
For
solver
=simulatedannealing
orneldermead
, it’s the method used to compute the first depth.- spacestr {‘sphere’, ‘euclidean’}, default = sphere
For
solver
=coordinatedescent
orneldermead
, it’s the type of spacecin which- line_solverstr {‘uniform’, ‘goldensection’}, default = goldensection
For
solver
=coordinatedescent
, it’s the line searh strategy used by this solver.- bound_gcbool, default = True
- For
solver
=neldermead
, it’sTrue
if the search is limited to the closed hemispher pretransform: str, default=”1Mom” The method of data scaling.
'1Mom'
or'NMom'
for scaling using data moments.'1MCD'
or'NMCD'
for scaling using robust data moments (Minimum Covariance Determinant (MCD).
- For
- kernel: str, default=”EDKernel”
'EDKernel'
for the kernel of type 1/(1+kernel.bandwidth*EuclidianDistance2(x,y)),'GKernel'
[default and recommended] for the simple Gaussian kernel,'EKernel'
exponential kernel: exp(-kernel.bandwidth*EuclidianDistance(x, y)),'VarGKernel'
variable Gaussian kernel, where kernel.bandwidth is proportional to the depth.zonoid of a point.- kernel_bandwidth: int, default=0
the single bandwidth parameter of the kernel. If
0
- the Scott`s rule of thumb is used.- k: float, 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.
- Returns
fig, ax, im