# State Evaluation of Electrical Equipment in Substations Based on Data Mining
## 2 Methodology
### Association Rules  
Equipment status analysis and evaluation involve identifying co-occurring features and isolating relevant elements from the broader feature set. Association rules are then derived to clarify relationships between equipment statuses, facilitating current assessment and future prediction based on real-time data.  
For this purpose, the a priori algorithm is employed. The a priori algorithm iteratively generates candidate itemsets, comparing them against a predetermined threshold for requirement fulfillment. This process continues until all possible itemsets re-evaluated and frequent itemsets are identified [27; 28; 29].  
The initial step involves extracting frequent itemsets from the dataset. Given k candidate items in the overall itemset, the itemset is defined as \(I=\{i_{1},i_{2},\ldots,i_{k}\}\). The candidate itemset 1 for the first iteration is \(C_{1}=\{\{i_{1}\},\{i_{2}\},\ldots,\{i_{k}\}\}\).  
After creating the candidate set, the algorithm scans the transaction database to compute support values for each candidate itemset.  
\[support(\{i_{k}\})=\frac{count(\{i_{k}\})}{|D|} \tag{6}\]  
It can be understood as the ratio of the number \(count(\{i_{k}\})\) containing the set of items to the total number \(|D|\). Then, record all items with support value greater than or equal to the threshold \(minsup\) as frequent 1 itemset  
\[L_{1}=\{\{i_{k}\}\in C_{1}|support(\{i_{k}\})\geq minsup\} \tag{7}\]  
Assuming \(L_{1}=\{\{j_{1}\},\{j_{2}\},\ldots,\{j_{m}\}\}\), a candidate 2-itemset \(C_{2}=\{\{j_{1},j_{2}\},\{j_{1},j_{3}\},\{j_{1},j_{4}\},\ldots,\{j_{m-1},j_{m}\}\) generated from \(L_{1}\). Similarly, the support for each candidate itemset is calculated  
\[support(\{j_{m-1},j_{m}\})=\frac{count(\{\{j_{m-1},j_{m}\}\})}{|D|} \tag{8}\]  
All items with support greater than or equal to the threshold \(minsup\) are recorded as frequent itemsets  
\[L_{2}=\{\{j_{m-1},j_{m}\}\in C_{2}|support(\{j_{m-1},j_{m}\})\geq minsup\} \tag{9}\]  
This process iterates until \(L_{k}=\emptyset\) or \(C_{k}=\emptyset\), completing frequent itemset generation. The final frequent itemset \(L=L_{1}\cup L_{2}\cup L_{3}\cup\ldots L_{i}\) is the union of all \(L_{i}\). Figure 3 illustrates this process flow.  
Association rules are calculated for itemset \(x_{1}\) given the occurrence of itemset \(x_{2}\). Multiple indicators are used to evaluate these rules.  
Confidence, or conditional probability in statistics, indicates the correlation degree between two itemsets [30]. It is mathematically expressed as  
\[Confidence(x_{2}\to x_{1})=\frac{Support(\{x_{1},x_{2}\})}{Support(\{x_{2}\})} \tag{10}\]  
The algorithm sets a minimum confidence threshold, \(minconf\). When the confidence level is higher than \(minconf\) value, the association rules are considered acceptable and further evaluated using other indicators.  
Lift, another evaluation metric, is calculated as  
\[Lift(x_{2}\to x_{1})=\frac{Confidence(x_{2}\to x_{1})}{Support(\{x_{1}\})} \tag{11}\]A lift value is greater than one indicates a positive correlation, suggesting \(x_{2}\)'s occurrence increases \(x_{1}\)'s likelihood [13; 31]. This metric helps determine the association strength between itemsets.  
Cosine similarity, often used to define rule strength, is calculated as:  
\[Cosine(x_{2}\to x_{1})=\frac{Support(\{x_{1},x_{2}\})}{\sqrt{Support(\{x_{1}\}) \times Support(\{x_{2}\})}} \tag{12}\]  
Values range from zero to one, with higher values indicating stronger association rules.