Depth and Depth-Based Classification with R Package ddalpha

Oleksii Pokotylo, Pavlo Mozharovskyi, Rainer Dyckerhoff

Abstract

Following the seminal idea of Tukey (1975), 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α-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.

TL;DR

The ddalpha R package provides a robust, nonparametric framework for classification by mapping complex data into a "depth space." Its flagship $DD\alpha$-classifier uses an efficient heuristic to find separating hyperplanes, offering a powerful alternative to traditional parametric models for both standard multivariate datasets and functional data like curves and time series.

Addressing the Limitations of Parametric Models

Traditional classification methods often rely on rigid parametric assumptions, such as assuming data follows a normal distribution. When data is skewed, multimodal, or contains heavy-tailed outliers, these models often fail.

"Data depth" offers a solution by measuring how "central" a point is relative to a data cloud. However, using depth for classification has historically been difficult due to computational complexity in high dimensions, the "outsider" problem (where points outside the training convex hull have zero depth), and fragmented software implementations. The ddalpha package addresses these gaps by consolidating seven major depth functions into one optimized, C++ backed package and introducing a novel, fast classification procedure.

Methods and the $DD\alpha$-Classifier

The core of the package is the $DD\alpha$-classifier. The process works in three main stages:

  1. Depth Transformation: Every data point in the $d$-dimensional feature space is mapped into a $q$-dimensional "depth space" (where $q$ is the number of classes). Each coordinate represents the point's depth relative to a specific class.
  2. The $\alpha$-Procedure: Instead of fitting complex polynomials, ddalpha uses an iterative heuristic to find an optimal separating hyperplane in the depth space. This is significantly faster than previous polynomial-based depth classifiers.
  3. Outsider Treatment: For points with zero depth, the package allows users to "plug in" secondary classifiers like LDA, QDA, or k-Nearest Neighbors to ensure every point gets a label.
Visualization of different depth notions (Mahalanobis, Projection, and Spatial) applied to bivariate data, showing both 3D surfaces and 2D contours.

For functional data (like ECG readings), the authors use an LS-transform (Location-Slope). This "finitizes" infinite-dimensional curves by integrating their levels and slopes over specific intervals before passing them to the depth classifier.

Key Insights: Geometry and Robustness

  • Topology Simplification: Mapping data into depth space often simplifies its geometry. A non-linear, complex boundary in the original feature space can often become a simple linear separation in depth space.
  • Robustness by Design: Because most depth functions are based on the relative positioning of points rather than mean/variance, the resulting classifiers are naturally resistant to extreme outliers.
  • Outsiders are Information: Identifying a point as an outsider tells the researcher that the observation is atypical relative to the training set, which is valuable diagnostic information for anomaly detection.

Key Results

  • Efficiency: By implementing the algorithms in C++ and using the $\alpha$-procedure, the package handles samples of $n=1000$ in low dimensions ($d \leq 3$) in under a second.
  • Multivariate Accuracy: On the Blood Transfusion Service Center dataset, the $DD\alpha$-classifier achieved an error rate of approximately 22.3%.
  • Functional Success: In the Berkeley Growth Study, the functional classifier achieved a remarkably low error rate of 5.4% in distinguishing between boys and girls based on growth curves.

Limitations and Future Work

While optimized, exact depth calculations for certain notions (like Simplicial or Halfspace) still scale exponentially with dimension ($d$). For very high-dimensional data, users must rely on the provided random projection approximations. Additionally, for functional data, the choice of intervals for the Location-Slope transform remains a computationally intensive step. Future directions include exploring "nowhere-vanishing" depths to eliminate the outsider problem entirely while maintaining geometric interpretability.

Summary updated

BibTeX
@article{pokotylo2019depth,
  author = {Oleksii Pokotylo and Pavlo Mozharovskyi and Rainer Dyckerhoff},
  title = {{Depth and Depth-Based Classification with <i>R</i> Package <b>ddalpha</b>}},
  journal = {Journal of Statistical Software},
  year = {2019},
  doi = {10.18637/jss.v091.i05},
}
Figure