Research Article

Equipment Quality Information Mining Method Based on Improved Apriori Algorithm

Algorithm 1

The process of the improved Apriori algorithm.
Input: import data set to generate numerical matrix D
Step1 set the minimum support count min_sup
Step2 scan all the data to generate L1: the set of frequent 1-itemsets. The main steps are as follows:
Step2.1 create identity matrix E with n rows and n columns, where n is the number of columns of matrix D
Step2.2 calculate the sum of each column of matrix D and store it in matrix B in turn
Step2.3 compare all elements of matrix B with min_sup, if the i-th element of B is less than min_sup, then delete that element and the i-th row of matrix E
Step2.4 connect matrix E and matrix B’ in the vertical direction to obtain matrix L. At this time, E is a frequent 1-itemset, and L contains both frequent 1-itemsets and corresponding support of the itemsets
Step3 combines all item sets contained in frequent 1-itemset L1 in pairs, connects the newly generated 2-itemsets in the horizontal direction to obtain matrix C, that is, candidate 2-itemset C2
Step4 if C is not an empty set, prune C according to min_sup to get the frequent k- itemset Lk. The main steps are as follows:
Step4.1 let m be the number of rows of C, let t be the number of rows of matrix D, and let
Step4.2 create zero matrix N with m rows and 1 column
Step4.3 create an all-one matrix H with t rows and 1 column
Step4.4 find the elements equal to 1 in the i-th row of C, store the subscripts of these elements with matrix ind, and count the number of elements as n
Step4.5 take the value stored in ind as the column subscript, read the corresponding n columns data in matrix D, and perform an and operation with matrix H
Step4.6 find the sum of all elements of matrix H and store it in x, if , then delete the i-th row of C and N, ; Otherwise, let ,
Step4.7 if , turn to step4.3; Otherwise, connect matrix C and matrix N in the vertical direction to obtain the frequent k-itemset Lk
Step5 if Lk is not an empty set, connect matrix L and matrix Lk in the horizontal direction to expand matrix L
Step6 make, and generate candidate k+1-itemset Ck+1 from frequent k-itemset Lk. The main steps are as follows:
Step6.1 let m be the number of rows of Lk and n be the number of columns of matrix Lk
Step6.2 create a zero matrix C with 0 rows and n columns; let
Step6.3 make
Step6.4 make , , and
Step6.5 if , let ,
Step6.6 if or , turn to step6.8
Step6.7, if , turn to step6.5; Otherwise, turn to step6.8
Step6.8 if , turn to step6.26
Step6.9 make , ,
Step6.10 if , let
Step6.11 if , let
Step6.12 if , turn to step6.14
Step6.13, if , turn to step6.10; Otherwise turn to step6.14
Step6.14 make
Step6.15 make
Step6.16 find the elements equal to 1 in the i-th row of Lk, and store the subscripts of these elements with matrix ind1
Step6.17 make
Step6.18 make and delete the x-th element of ind2
Step6.19 make
Step6.20 make
Step6.21, if , turn to step6.20; Otherwise, turn to step6.22
Step6.22 if the sum of all the elements of flag is 0, turn to step6.24
Step6.23, if , turn to step6.18; Otherwise turn to step6.24
Step6.24 if the sum of all the elements of flag is not 0, let , connect matrix C and c in the horizontal direction
Step6.25, if , turn to step6.4; Otherwise turn to step6.26
Step6.26, if , turn to step6.3; Otherwise, turn to step 7. At this time, matrix C is candidate k+1-itemset Ck+1
Step7 if C is not an empty set, turn to Step4; Otherwise end
Output: numerical matrix L, representing all frequent itemsets and corresponding support