# Density Kernel Depth for Outlier Detection in Functional Data

The Density Kernel Depth (DKD) method provides a nuanced approach to detect outliers in functional data, offering clarity in complex datasets and ensuring data quality. Its application becomes crucial as we navigate increasingly intricate data landscapes.

Image generated from DALLE-3

# Introduction

In today's era of massive data sets and intricate data patterns, the art and science of detecting anomalies, or outliers, have become more nuanced. While traditional outlier detection techniques are well-equipped to deal with scalar or multivariate data, functional data – which consists of curves, surfaces, or anything in a continuum – poses unique challenges. One of the groundbreaking techniques that has been developed to address this issue is the 'Density Kernel Depth' (DKD) method.

In this article, we will delve deep into the concept of DKD and its implications in outlier detection for functional data from a data scientist's standpoint.

# 1. Understanding Functional Data

Before we delve into the intricacies of DKD, it's vital to understand what functional data entails. Unlike traditional data points which are scalar values, functional data consists of curves or functions. Think of it as having an entire curve as a single data observation. This type of data often arises in situations where measurements are taken continuously over time, such as temperature curves over a day or stock market trajectories.

Given a dataset of n curves observed on a domain D, each curve can be represented as:

# 2. The Challenge with Outlier Detection in Functional Data

For scalar data, we might compute the mean and standard deviation and then determine outliers based on data points lying a certain number of standard deviations away from the mean.

For functional data, this approach is more complicated because each observation is a curve.

One approach to measure the centrality of a curve is to compute its "depth" relative to other curves. For instance, using a simple depth measure:

Where n is the total number of curves.

While the above is a simplified representation, in reality, functional datasets can consist of thousands of curves, making visual outlier detection challenging. Mathematical formulations like the Depth measure provide a more structured approach to gauge the centrality of each curve and potentially detect outliers.

In a practical scenario, one would need more advanced methods, like the Density Kernel Depth, to effectively determine outliers in functional data.

# 3. How DKD Works

DKD works by comparing the density of each curve at each point to the overall density of the entire dataset at that point. The density is estimated using kernel methods, which are non-parametric techniques that allow for the estimation of densities in complex data structures.

For each curve, the DKD evaluates its "outlyingness" at every point and integrates these values over the entire domain. The result is a single number representing the depth of the curve. Lower values indicate potential outliers.

The kernel density estimation at point t for a given curve Xi?(t) is defined as:

Where:

• K (.) is the kernel function, often a Gaussian kernel.
• h is the bandwidth parameter.

The choice of kernel function K (.) and bandwidth h can significantly influence the DKD values:

• Kernel Function: Gaussian kernels are commonly used due to their smooth properties.
• Bandwidth ?: It determines the smoothness of the density estimate. Cross-validation methods are often employed to select an optimal h.

# 3. Density Kernel Depth Calculation

The depth of curve Xi?(t) at point t in relation to the entire dataset is calculated as:

where:

The resulting DKD value for each curve gives a measure of its centrality:

• Curves with higher DKD values are more central to the dataset.
• Curves with lower DKD values are potential outliers.

# 4. Advantages of Using DKD in Functional Data Analysis

Flexibility: DKD does not make strong assumptions about the underlying distribution of the data, making it versatile for various functional data structures.

Interpretability: By providing a depth value for each curve, DKD makes it intuitive to understand which curves are central and which ones are potential outliers.

Efficiency: Despite its complexity, DKD is computationally efficient, making it feasible for large functional datasets.

# 5. Practical Implications

Imagine a scenario where a data scientist is analyzing heart rate curves of patients over 24 hours. Traditional outlier detection might flag occasional high heart rate readings as outliers. However, with functional data analysis using DKD, entire abnormal heart rate curves – perhaps indicating arrhythmias – can be detected, providing a more holistic view of patient health.

# Conclusion

As data continues to grow in complexity, the tools and techniques to analyze it must evolve in tandem. Density Kernel Depth offers a promising approach to navigate the intricate landscape of functional data, ensuring that data scientists can confidently detect outliers and derive meaningful insights from them. While DKD is just one of the many tools in a data scientist's arsenal, its potential in functional data analysis is undeniable and is set to pave the way for more sophisticated analysis techniques in the future.

Kulbir Singh is a distinguished leader in the realm of analytics and data science, boasting over two decades of experience in Information Technology. His expertise is multifaceted, encompassing leadership, data analysis, machine learning, artificial intelligence (AI), innovative solution design, and problem-solving. Currently, Kulbir holds the position of Health Information Manager at Elevance Health. Passionate about the advancement of Artificial Intelligence (AI), Kulbir founded AIboard.io, an innovative platform dedicated to creating educational content and courses centered on AI and healthcare.