## 2 Methodology
### PSO-Optimized k-Means Algorithm  
The original value-based monitoring dataset must be changed into a category-based transactional database since the Apriori algorithm for association rule mining is category-based. The k-means algorithm is the most well-known clustering algorithm, whose core objective is to classify the dataset into K clusters, with the elements in each cluster having a high degree of similarity. The k-means algorithm is simple to implement and fast to cluster,  
Figure 1: Flowchart of association rule mining for the Lishanyuan landslide. but it is very sensitive to the choice of initial cluster centers. Different initial values may lead to different clustering results, i.e., local optima rather than global optima. To solve this problem, we used the PSO algorithm for global optimization. The PSO algorithm is an evolutionary algorithm based on population intelligence that finds the optimal solution by simulating the process of a flock of birds searching for food. The specific steps of the k-means clustering algorithm optimized by PSO are as follows:  
Step 1: Particle swarm initialization. Suppose there is a particle swarm composed of m particles in a given D-dimensional search space, and each particle has only two attributes: position and velocity, where position is the code of the solution to be solved and the velocity is the iteration step size. For the \(i-th\) particle, its coordinate position can be expressed as:  
\[X_{i}\ =\ \big{(}x_{i1},\ \ \ x_{i2},\ \ \cdots,\ \ \ x_{iD}\big{)} \tag{1}\]  
The velocity of the \(i-th\) particle can be expressed as:  
\[V_{i}\ =\ \big{(}v_{i1},\ \ \ v_{i2},\ \ \cdots,\ \ \ v_{iD}\big{)} \tag{2}\]  
When performing k-means clustering on the dataset \(D\ =\ \big{\{}x_{1},\ \ \ x_{2},\ \ \ \cdots,\ \ \ x_{n}\big{\}}\), the initial cluster centers \(C\ =\ \big{\{}\mu_{1},\ \ \mu_{2},\ \ \ \cdots,\ \ \mu_{k}\big{\}}\) need to be specified. In order to avoid the problem of local optimal clustering caused by the sensitivity of \(C\), we coded \(C\) as \(X_{i}\) in Equation (1) for global optimization. Step 2: Particle clustering and fitness calculation. Perform k-means clustering after decoding each particle in the particle swarm. The specific steps are as follows:  
Sub-step 2.1: For each element \(x_{i}\) in the dataset \(D\), the Euclidean distance \(d_{ij}\ =\ \sqrt{\sum\limits_{i=1}^{n}\big{(}x_{i}-\mu_{j}\big{)}^{2}}\) between \(x_{i}\) and the center \(\mu_{j}\) of each cluster is calculated and the current element \(x_{i}\) is assigned to the cluster \(C_{j}\) represented by the center with the smallest distance. Sub-step 2.2: For each cluster \(C_{j}\) obtained in Sub-step 2.1, the central \(\mu_{j}^{{}^{\prime}}\ =\ \frac{1}{|C_{j}|}\sum\limits_{x\in C_{j}}x\) of that cluster is recalculated and the \(C\ =\ \big{\{}\mu_{1},\ \ \mu_{2},\ \ \ \cdots,\ \ \mu_{k}\big{\}}\) is updated. Sub-step 2.3: Repeat the sub-step 2.1 and 2.2 until the center \(\mu_{j}^{{}^{\prime}}\) and element \(x_{i}\) of each cluster \(C_{j}\) no longer change. Then, the final clustering result can be obtained. Sub-step 2.4: To evaluate the clustering effect of the current position of each particle, the following equation is used to calculate the fitness \(F(i)\) of each particle. \[F(i)\ =\ \sum\limits_{i=1}^{n}\sum\limits_{j=1}^{k}\big{(}x_{i}-\mu_{j} \big{)}^{2} \tag{3}\]  
where \(x_{i}\) denotes the \(i-th\) element in the dataset, and \(\mu_{j}\) is the center of the \(i-th\) cluster. The fitness function represents the sum of the squares of the distances between each element and the center of the cluster to which the element belongs, and the smaller the fitness, the better the clustering effect. The individual optimal solution \(P_{i}\) and the group optimal solution \(g_{best}\) can be obtained through fitness.