Depth and depth-based classification with R-package ddalpha

Oleksii Pokotylo, Pavlo Mozharovskyi, Rainer Dyckerhoff · DOI

Abstract

Following the seminal idea of Tukey, data depth is a function that measures how close an arbitrary point of the space is located to an implicitly defined center of a data cloud. Having undergone theoretical and computational developments, it is now employed in numerous applications with classification being the most popular one. The R-package ddalpha is a software directed to fuse experience of the applicant with recent achievements in the area of data depth and depth-based classification. ddalpha provides an implementation for exact and approximate computation of most reasonable and widely applied notions of data depth. These can be further used in the depth-based multivariate and functional classifiers implemented in the package, where the $DD\alpha$-procedure is in the main focus. The package is expandable with user-defined custom depth methods and separators. The implemented functions for depth visualization and the built-in benchmark procedures may also serve to provide insights into the geometry of the data and the quality of pattern recognition.

Introduction

In statistics, determining the "typicality" of a data point is straightforward in univariate settings but becomes increasingly complex in high-dimensional or functional spaces. Data depth offers a non-parametric solution, ordering data from the center outward to capture shape, scatter, and location without assuming a specific underlying distribution. However, practical application has been hindered by computational intensity, the "outsider" problem (where points fall outside the training data's convex hull), and fragmented software implementations. The ddalpha R package addresses these challenges by providing a fast, C++-backed framework for multivariate and functional data classification.

Methods

1. Depth Notions

The package implements seven major depth functions, including Mahalanobis, Tukey (halfspace), and Simplicial depth. It utilizes exact algorithms for low dimensions and optimized approximations for high-dimensional data.

Visual comparison of Mahalanobis, Projection, and Spatial depth notions showing their respective 3D surfaces and 2D contour maps.

As shown in the figure above, different depth notions capture the geometry of the data cloud in distinct ways, providing flexibility depending on the expected data structure and robustness requirements.

2. The $DD\alpha$-Classifier

The flagship $DD\alpha$-classifier operates in two phases. First, the Depth Transform maps training points into a $q$-dimensional "depth space" relative to each class. Second, the $\alpha$-procedure applies a fast, iterative heuristic to find an optimal separating hyperplane. This approach transforms complex, non-linear boundaries in the original space into more manageable linear problems in depth space.

3. Functional Data Extension

For functional data, such as curves representing time-series observations, ddalpha employs a Location-Slope ($LS$-) transform. This converts curves into two-dimensional points—representing average value and average slope—before passing them into the depth machinery.

The Location-Slope (LS-) transform applied to functional data, showing the original location curves (left) and their corresponding slopes (right).

Key Results and Insights

  • Computational Efficiency: By leveraging C++ and libraries like Boost and Rcpp, ddalpha achieves high performance. For 2D data with 1,000 points, calculations take less than a second. Even complex depths like Zonoid remain efficient in higher dimensions.
  • Classification Robustness: In benchmarks using Student-$t$ distributions, the $DD\alpha$-classifier consistently matched or outperformed traditional maximum-depth classifiers, showing particular stability compared to polynomial separators.
  • Depth as Feature Extraction: The package treats depth as a powerful non-linear feature transformation. Moving data into "depth space" often makes complex, non-linear boundaries linearly separable.
  • Handling Outsiders: The package provides several strategies for classifying "outsiders" (points with zero depth), such as LDA or $k$-Nearest Neighbors, ensuring that atypical observations are handled gracefully rather than ignored.

Conclusion

The ddalpha package provides a unified and efficient toolkit for depth-based statistics. By bridging the gap between theoretical depth notions and practical classification tasks, it offers researchers a robust platform for multivariate and functional data analysis. Its modular structure allows for easy extension with custom depth functions and separators, inviting community contribution to the field of pattern recognition.

Summary updated

BibTeX
@article{pokotylo2019depth,
  author = {Oleksii Pokotylo and Pavlo Mozharovskyi and Rainer Dyckerhoff},
  title = {{Depth and depth-based classification with R-package ddalpha}},
  journal = {Journal of Statistical Software},
  year = {2019},
  doi = {10.18637/jss.v091.i05},
}
Figure