# Prediction Method for Mine Earthquake in Time Sequence Based on Clustering Analysis
## 2 Methodology Background  
### Spatial Temporal-DBSCAN  
The ST-DBSCAN algorithm adds time dimension on the basis of the DBSCAN algorithm to form a spatial-temporal neighborhood with spatial distance as radius and time interval as height, which is used for the clustering analysis of spatial-temporal data. As shown in Figure 1, the algorithm identifies the density of samples through three parameters, namely space radius \(Eps\), time window \(\Delta T\) and density threshold \(Minpts\). Based on this, the data meeting the conditions are divided to form the final cluster set.  
Where \(Eps\) is used to measure the distance between two spatial-temporal data in the spatial dimension and \(\Delta T\) is used to measure the distance in the time dimension. For example, \(A(x_{1},y_{1},z_{1},t_{1})\) and \(B(x_{2},y_{2},z_{2},t_{2})\) represent two spatial-temporal data, where \((x_{1},y_{1},z_{1})\) and \((x_{2},y_{2},z_{2})\) are spatial attributes and \(t_{1}\) and \(t_{2}\) are temporal attributes, then the calculation formulas of \(Eps\) and \(\Delta T\) are as follows:  
\[Eps=\sqrt{\left(x_{1}-x_{2}\right)^{2}+\left(y_{1}-y_{2}\right)^{2}+\left(z_{ 1}-z_{2}\right)^{2}} \tag{1}\]  
\[\Delta T=\left|t_{1}-t_{2}\right| \tag{2}\]  
The ST-DBSCAN algorithm uses the threshold parameter \(Minpts\) to represent the minimum number of sample points required for clustering in the spatial-temporal neighborhood, which can be obtained from the total number \(N\) of microseism events. The calculation formula is as follows:  
\[Minpts=lnN \tag{3}\]  
According to the relevant definitions of the ST-DBSCAN algorithm, the algorithm starts loop judgment after inputting the sample data set. If the number of adjacent points within the space radius \(Eps\) and time window \(\Delta T\) of the core point is not less than \(Minpts\), a cluster will be formed. Otherwise, the next point will be judged until all points have completed traversal and judgment. The specific construction steps are described as follows:  
1. Algorithm inputs: sample data set \(D\), spatial radius parameter \(Eps\), time window parameter \(\Delta T\), density threshold \(Minpts\).
2. Establish a tag list \(L\), which is used to mark whether the sample point has completed the traversal state, and initially set the traversal state \(L=0\) of all points in \(D\).
3. Start traversal, randomly select point \(d\) in \(D\), and set its traversal state to \(L=1\).
4. Start loop 1, if the number of points in the \(Eps\) and \(\Delta T\) spatial-temporal neighborhood of \(d\) is not less than \(Minpts\), create a new cluster \(C\), add \(d\) to \(C\), otherwise mark \(d\) as a noise point.
5. \(D^{*}\) represents the set of all points in the \(Eps\) and \(\Delta T\) spatial-temporal neighborhood of \(d\).
6. Start loop 2, traversing each point \(d^{*}\) in \(D^{*}\).
7. If \(L=0\) of \(d^{*}\), select this point and set \(L=1\) of \(d^{*}\).
8. If the number of points in the \(Eps\) and \(\Delta T\) spatial-temporal neighborhood of \(d^{*}\) is not less than \(Minpts\), add these points to the set \(D^{*}\).
9. If \(d^{*}\) does not belong to any cluster, add \(d^{*}\) to cluster \(C\).
10. End loop 2, and the algorithm outputs the set of cluster \(C\).  
Figure 1: Schematic representation of the spatial-temporal neighborhood.  
11. End loop 1, the termination condition of the algorithm is that the traversal states of all data points are \(L=1\), that is, all data points have been processed, either classified into a cluster or marked as noise points.