# Analysis of Urban Residents' Travelling Characteristics and Hotspots Based on Taxi Trajectory Data
## 2 Materials and Methods
### Kernel Density Analysis of Trajectory Points  
Kernel density estimation (KDE) is a suitable technique for analyzing and visualizing geographical information data that include location information, such as trajectory data. It is a nonparametric method used to estimate the probability density function [28]. Kernel density analysis is valuable for identifying areas with varying densities, analyzing the frequency of different data points, and estimating the spatial density of point features within a series of trajectory points. In this paper, the kernel density analysis was conducted in conjunction with HDBSCAN clustering. Here are the main concepts introduced:  
1. Kernel function: This function assigns weights to each data point, creating a smooth distribution around them and estimating a continuous probability density function from discrete data. In this experiment, the Gaussian kernel, resembling a normal distribution curve and suitable for most scenarios, was used. The mathematical expression of the Gaussian kernel is shown in Equation (5): \[K(u)=\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}u^{2}},\] (5) where \(K(u)\) is the value of the kernel function at point \(u\); \(e\) is the base of the natural logarithm, approximately equal to 2.71828; \(\pi\) is the pi ratio, approximately equal to 3.14159; and \(u\) is the standardized distance from the origin, calculated as \(\frac{x-x_{i}}{h}\), where \(x\) is the evaluation point, \(x_{i}\) is the data point, and \(h\) is the bandwidth.
2. Bandwidth selection: Bandwidth is a crucial parameter in KDE as it dictates the smoothness of the kernel function. An overly large bandwidth can result in overfitting, where the model excessively conforms to the data set. Conversely, a small bandwidth can lead to underfitting, failing to capture the underlying trends in the data. Therefore, choosing an appropriate bandwidth value is essential for accurate KDE.
3. KDE calculation formula: The mathematical formulation of KDE is outlined in Equation (6): \[f(x)=\frac{1}{nh}{\sum_{i=1}^{n}K\bigg{(}\frac{x-x_{i}}{h}\bigg{)}},\] (6) where \(f(x)\) represents the estimated density of trajectory points at position \(x\), \(n\) is the number of sample points, \(x_{i}\) is the sample trajectory point, \(h\) is the broadband parameter, and \(K\) is the kernel function.  
To demonstrate the effectiveness of this approach, 44,753 data points from weekdays were selected for a clustering comparison. Both single kernel density analysis and kernel density analysis after clustering (with noise points excluded) were performed. After noise point exclusion, 37,460 data points remained. In both clustering scenarios, the chosen bandwidth value h was 0.2, with all other conditions kept constant. The resulting kernel density estimations are presented in Figure 9.  
By comparing Figure 9a,b, it becomes evident that after removing the noise points, the kernel density analysis provides a richer and more accurate representation of data point density. This is evident in the varying color depths, which more precisely reflect the density changes in the data points.