Original link:tecdat.cn/?p=5393

 

Research on coal mine hazard data mining to realize the effective utilization of the massive hidden data, based on the analysis of mine data mining technology and the characteristics of coal mine hazard data, on the basis of proposed coal mine hazard data mining is an important part of digital mine, coal mine hazard is given the concept of data mining, design of the coal mine hazard data mining model, Furthermore, the mining algorithm suitable for coal mine hidden danger data is analyzed. Taking association algorithm as an example, mining multi-dimensional association rules for hidden danger data, analyzing the mining results show that there is close correlation between hidden danger multi-dimensional data, which can provide support for coal mine safety decision.

  

 

The following uses R language as an example to introduce the application of association rules in the management of coal mine hazards

Dat1 =read. CSV (" Hidden data Fp-growth. CSV ",header=T,stringsAsFactors=T) Read data head(dat1)have a look at data Hidden date hidden unit Number of hidden problems 11 2009/1/2 5 Fully mechanized mining team Zhang Lixin 1106 working face 2 2009/1/2 Fully mechanized mining team Zhao Jun Sun Xuguang 1106 working face 3 2009/1/2 Fully mechanized mining team Lang Zhijun Zhao Jianjun 1106 working face 4 2009/1/2 Four strips in Mechanical and Electrical Team 2, Song Hui-gang, Li Si-guang, Mining area 1 tape Lane 5 2009/1/2 Four strips in Mechanical and electrical Team 2, Song Hui-gang, Li Si-guang, mining area 1 Tape lane 6 2009/1/2 Four strips in Mechanical and electrical Team 2, Song Hui-gang, Li Si-guang, mining area 1 Tape lane Handling measures Time 1 treatment 2009/3 /3 Zhao Hagen 1, there are two groups of support high pressure hose broken 2 treatment open water curtain 2009/3 /3 Chen Xiaodan 1, belt head hard frame tail pressure column is not strong 3 adjustment management 2009/3 /3 Chen Xiaodan 2, 60-66 coal wall soft, There is a piece of help phenomenon 4 rectification 2009/3 3 Cui Qingzhong 1, the main belt uphill first stop has a shaw did not insert in place 5 rectification 2009/3 3 Cui Qingzhong 2, the main belt head fire water pipe did not put 6 rectification 2009/3 3 Cui Qingzhong 4, the main belt head has a lamp head did not hang hidden trouble theme Hidden trouble time 1 support problem first quarter 2 belt machine problem first quarter 3 piece help problem first quarter 4 belt machine problem first quarter 5 fire problem first quarter 6 belt machine problem first quarter hidden trouble theme, hidden trouble time, hidden trouble place and hidden trouble unit Dat1 =as(dat1[c], dat1=as(dat1[c], dat1], "Transactions ") inspect(frequentsets[1:10]) review frequentsets items support [1] {frequentsets = frequentsets, frequentsets.1= working face} 0.05327004 [3] {hidden trouble theme = support problem, hidden trouble location.1= working face} 0.06329114 [4] {hidden trouble time = second quarter, hidden trouble location.1= monkey car lane} [6] {hidden trouble time = the second quarter, hidden trouble unit = a group of comprehensive digging} 0.05000000 [7] {hidden trouble place.1= wind lane, hidden trouble unit = a group of comprehensive digging} [8] {hidden trouble time = second quarter, hidden trouble unit = comprehensive excavation team 2} 0.05527426 [9] {hidden trouble time = second quarter, hidden trouble unit = comprehensive excavation team 3} 0.05991561 [10] {hidden trouble place.1= working face, hidden trouble unit = comprehensive mining team} Sort and inspect the obtained frequent item set according to the support (equivalent to inspect(sort(frequentsets)[1:10]) items support [1] {hidden time = q2} 0.3750000 [2] 1= working face} 0.2995781 [3] {hidden trouble time = first quarter} 0.2668776 [4] {hidden trouble time = third quarter} 0.1997890 [5] {hidden trouble unit = comprehensive safety team} 0.1775316 [6] {hidden trouble location.1= wind lane} 0.1585443 [7] {hidden trouble location.1= working face, hidden trouble unit = integrated safety team} 0.1521097 [8] {hidden trouble subject = bolt problem} 0.1464135 [9] {hidden trouble time = fourth quarter} 0.1437764 [10] {hidden trouble subject = belt machine problem} 0.1431435Copy the code


fp growth tree Mine association rules


fptree=function (data, parameter = NULL, appearance = NULL, control = NULL) 
{
  data 
    appearance <- as(c(appearance, list(labels = itemLabels(data))), 
                     "APappearance")
  
    validObject(result@lhs@data)
    validObject(result@rhs@data)
  }
  else {
    validObject(result@items@data)
  }
  result
}


 
rules=fptree(dat1,parameter=list(support=0.06,confidence=0.1,minlen=2)) 求关联规则

 
summary(rules)Inspect transactions

 set of 25 rules
 
 rule length distribution (lhs + rhs):sizes
  2  3 
 22  3 
 
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    2.00    2.00    2.00    2.12    2.00    3.00 
 
 summary of quality measures:
     support          confidence          lift       
  Min.   :0.06276   Min.   :0.1868   Min.   :0.9775  
  1st Qu.:0.06456   1st Qu.:0.2928   1st Qu.:1.0806  
  Median :0.07078   Median :0.4244   Median :1.3247  
  Mean   :0.08642   Mean   :0.4940   Mean   :2.5253  
  3rd Qu.:0.08829   3rd Qu.:0.6643   3rd Qu.:3.2100  
  Max.   :0.15211   Max.   :0.9676   Max.   :7.2803  
 
 mining info:
  data ntransactions support confidence
  dat1          9480    0.06        0.1

inspect(head(rules))

     lhs                    rhs                 support    confidence
 [1] {隐患主题=支架问题} => {隐患地点.1=工作面} 0.06329114 0.9600000 
 [2] {隐患地点.1=工作面} => {隐患主题=支架问题} 0.06329114 0.2112676 
 [3] {隐患地点.1=猴车巷} => {隐患单位=综掘三队} 0.08829114 0.9676301 
 [4] {隐患单位=综掘三队} => {隐患地点.1=猴车巷} 0.08829114 0.6642857 
 [5] {隐患单位=综掘一队} => {隐患地点.1=风巷}   0.08164557 0.7267606 
 [6] {隐患地点.1=风巷}   => {隐患单位=综掘一队} 0.08164557 0.5149701 
     lift    
 [1] 3.204507
 [2] 3.204507
 [3] 7.280264
 [4] 7.280264
 [5] 4.583959
 [6] 4.583959

quality(head(rules))

      support confidence     lift
 1 0.06329114  0.9600000 3.204507
 2 0.06329114  0.2112676 3.204507
 3 0.08829114  0.9676301 7.280264
 4 0.08829114  0.6642857 7.280264
 5 0.08164557  0.7267606 4.583959
 6 0.08164557  0.5149701 4.583959

rules <- sort(rules, by="support")
inspect(head(rules, n=40))Look at rules with highest support

      lhs                                      rhs                
 [1]  {隐患单位=综安队}                     => {隐患地点.1=工作面}
 [2]  {隐患地点.1=工作面}                   => {隐患单位=综安队}  
 [3]  {隐患单位=综采队}                     => {隐患地点.1=工作面}
 [4]  {隐患地点.1=工作面}                   => {隐患单位=综采队}  
 [5]  {隐患地点.1=工作面}                   => {隐患时间=第二季度}
 [6]  {隐患时间=第二季度}                   => {隐患地点.1=工作面}
 [7]  {隐患地点.1=猴车巷}                   => {隐患单位=综掘三队}
 [8]  {隐患单位=综掘三队}                   => {隐患地点.1=猴车巷}
 [9]  {隐患时间=第一季度}                   => {隐患地点.1=工作面}
 [10] {隐患地点.1=工作面}                   => {隐患时间=第一季度}
 [11] {隐患单位=综掘一队}                   => {隐患地点.1=风巷}  
 [12] {隐患地点.1=风巷}                     => {隐患单位=综掘一队}
 [13] {隐患单位=综安队}                     => {隐患时间=第二季度}
 [14] {隐患时间=第二季度}                   => {隐患单位=综安队}  
 [15] {隐患地点.1=风巷}                     => {隐患时间=第二季度}
 [16] {隐患时间=第二季度}                   => {隐患地点.1=风巷}  
 [17] {隐患地点.1=工作面,隐患单位=综安队}   => {隐患时间=第二季度}
 [18] {隐患时间=第二季度,隐患单位=综安队}   => {隐患地点.1=工作面}
 [19] {隐患时间=第二季度,隐患地点.1=工作面} => {隐患单位=综安队}  
 [20] {隐患时间=第三季度}                   => {隐患地点.1=工作面}
 [21] {隐患地点.1=工作面}                   => {隐患时间=第三季度}
 [22] {隐患主题=支架问题}                   => {隐患地点.1=工作面}
 [23] {隐患地点.1=工作面}                   => {隐患主题=支架问题}
 [24] {隐患单位=综安队}                     => {隐患时间=第一季度}
 [25] {隐患时间=第一季度}                   => {隐患单位=综安队}  
      support    confidence lift     
 [1]  0.15210970 0.8568033  2.8600336
 [2]  0.15210970 0.5077465  2.8600336
 [3]  0.13491561 0.9616541  3.2100286
 [4]  0.13491561 0.4503521  3.2100286
 [5]  0.10981013 0.3665493  0.9774648
 [6]  0.10981013 0.2928270  0.9774648
 [7]  0.08829114 0.9676301  7.2802642
 [8]  0.08829114 0.6642857  7.2802642
 [9]  0.08639241 0.3237154  1.0805712
 [10] 0.08639241 0.2883803  1.0805712
 [11] 0.08164557 0.7267606  4.5839588
 [12] 0.08164557 0.5149701  4.5839588
 [13] 0.07078059 0.3986928  1.0631808
 [14] 0.07078059 0.1887482  1.0631808
 [15] 0.07004219 0.4417831  1.1780883
 [16] 0.07004219 0.1867792  1.1780883
 [17] 0.06455696 0.4244105  1.1317614
 [18] 0.06455696 0.9120715  3.0445205
 [19] 0.06455696 0.5878963  3.3115012
 [20] 0.06339662 0.3173178  1.0592159
 [21] 0.06339662 0.2116197  1.0592159
 [22] 0.06329114 0.9600000  3.2045070
 [23] 0.06329114 0.2112676  3.2045070
 [24] 0.06276371 0.3535354  1.3247095
 [25] 0.06276371 0.2351779  1.3247095

 Look at rules with highest support

      lhs                                      rhs                
 [1]  {隐患地点.1=猴车巷}                   => {隐患单位=综掘三队}
 [2]  {隐患单位=综采队}                     => {隐患地点.1=工作面}
 [3]  {隐患主题=支架问题}                   => {隐患地点.1=工作面}
 [4]  {隐患时间=第二季度,隐患单位=综安队}   => {隐患地点.1=工作面}
 [5]  {隐患单位=综安队}                     => {隐患地点.1=工作面}
 [6]  {隐患单位=综掘一队}                   => {隐患地点.1=风巷}  
 [7]  {隐患单位=综掘三队}                   => {隐患地点.1=猴车巷}
 [8]  {隐患时间=第二季度,隐患地点.1=工作面} => {隐患单位=综安队}  
 [9]  {隐患地点.1=风巷}                     => {隐患单位=综掘一队}
 [10] {隐患地点.1=工作面}                   => {隐患单位=综安队}  
 [11] {隐患地点.1=工作面}                   => {隐患单位=综采队}  
 [12] {隐患地点.1=风巷}                     => {隐患时间=第二季度}
 [13] {隐患地点.1=工作面,隐患单位=综安队}   => {隐患时间=第二季度}
 [14] {隐患单位=综安队}                     => {隐患时间=第二季度}
 [15] {隐患地点.1=工作面}                   => {隐患时间=第二季度}
 [16] {隐患单位=综安队}                     => {隐患时间=第一季度}
 [17] {隐患时间=第一季度}                   => {隐患地点.1=工作面}
 [18] {隐患时间=第三季度}                   => {隐患地点.1=工作面}
 [19] {隐患时间=第二季度}                   => {隐患地点.1=工作面}
 [20] {隐患地点.1=工作面}                   => {隐患时间=第一季度}
 [21] {隐患时间=第一季度}                   => {隐患单位=综安队}  
 [22] {隐患地点.1=工作面}                   => {隐患时间=第三季度}
 [23] {隐患地点.1=工作面}                   => {隐患主题=支架问题}
 [24] {隐患时间=第二季度}                   => {隐患单位=综安队}  
 [25] {隐患时间=第二季度}                   => {隐患地点.1=风巷}  
      support    confidence lift     
 [1]  0.08829114 0.9676301  7.2802642
 [2]  0.13491561 0.9616541  3.2100286
 [3]  0.06329114 0.9600000  3.2045070
 [4]  0.06455696 0.9120715  3.0445205
 [5]  0.15210970 0.8568033  2.8600336
 [6]  0.08164557 0.7267606  4.5839588
 [7]  0.08829114 0.6642857  7.2802642
 [8]  0.06455696 0.5878963  3.3115012
 [9]  0.08164557 0.5149701  4.5839588
 [10] 0.15210970 0.5077465  2.8600336
 [11] 0.13491561 0.4503521  3.2100286
 [12] 0.07004219 0.4417831  1.1780883
 [13] 0.06455696 0.4244105  1.1317614
 [14] 0.07078059 0.3986928  1.0631808
 [15] 0.10981013 0.3665493  0.9774648
 [16] 0.06276371 0.3535354  1.3247095
 [17] 0.08639241 0.3237154  1.0805712
 [18] 0.06339662 0.3173178  1.0592159
 [19] 0.10981013 0.2928270  0.9774648
 [20] 0.08639241 0.2883803  1.0805712
 [21] 0.06276371 0.2351779  1.3247095
 [22] 0.06339662 0.2116197  1.0592159
 [23] 0.06329114 0.2112676  3.2045070
 [24] 0.07078059 0.1887482  1.0631808
 [25] 0.07004219 0.1867792  1.1780883

  Look at rules with highest lift

      lhs                                      rhs                
 [1]  {隐患地点.1=猴车巷}                   => {隐患单位=综掘三队}
 [2]  {隐患单位=综掘三队}                   => {隐患地点.1=猴车巷}
 [3]  {隐患单位=综掘一队}                   => {隐患地点.1=风巷}  
 [4]  {隐患地点.1=风巷}                     => {隐患单位=综掘一队}
 [5]  {隐患时间=第二季度,隐患地点.1=工作面} => {隐患单位=综安队}  
 [6]  {隐患单位=综采队}                     => {隐患地点.1=工作面}
 [7]  {隐患地点.1=工作面}                   => {隐患单位=综采队}  
 [8]  {隐患地点.1=工作面}                   => {隐患主题=支架问题}
 [9]  {隐患主题=支架问题}                   => {隐患地点.1=工作面}
 [10] {隐患时间=第二季度,隐患单位=综安队}   => {隐患地点.1=工作面}
 [11] {隐患单位=综安队}                     => {隐患地点.1=工作面}
 [12] {隐患地点.1=工作面}                   => {隐患单位=综安队}  
 [13] {隐患单位=综安队}                     => {隐患时间=第一季度}
 [14] {隐患时间=第一季度}                   => {隐患单位=综安队}  
 [15] {隐患地点.1=风巷}                     => {隐患时间=第二季度}
 [16] {隐患时间=第二季度}                   => {隐患地点.1=风巷}  
 [17] {隐患地点.1=工作面,隐患单位=综安队}   => {隐患时间=第二季度}
 [18] {隐患时间=第一季度}                   => {隐患地点.1=工作面}
 [19] {隐患地点.1=工作面}                   => {隐患时间=第一季度}
 [20] {隐患单位=综安队}                     => {隐患时间=第二季度}
 [21] {隐患时间=第二季度}                   => {隐患单位=综安队}  
 [22] {隐患时间=第三季度}                   => {隐患地点.1=工作面}
 [23] {隐患地点.1=工作面}                   => {隐患时间=第三季度}
 [24] {隐患地点.1=工作面}                   => {隐患时间=第二季度}
 [25] {隐患时间=第二季度}                   => {隐患地点.1=工作面}
      support    confidence lift     
 [1]  0.08829114 0.9676301  7.2802642
 [2]  0.08829114 0.6642857  7.2802642
 [3]  0.08164557 0.7267606  4.5839588
 [4]  0.08164557 0.5149701  4.5839588
 [5]  0.06455696 0.5878963  3.3115012
 [6]  0.13491561 0.9616541  3.2100286
 [7]  0.13491561 0.4503521  3.2100286
 [8]  0.06329114 0.2112676  3.2045070
 [9]  0.06329114 0.9600000  3.2045070
 [10] 0.06455696 0.9120715  3.0445205
 [11] 0.15210970 0.8568033  2.8600336
 [12] 0.15210970 0.5077465  2.8600336
 [13] 0.06276371 0.3535354  1.3247095
 [14] 0.06276371 0.2351779  1.3247095
 [15] 0.07004219 0.4417831  1.1780883
 [16] 0.07004219 0.1867792  1.1780883
 [17] 0.06455696 0.4244105  1.1317614
 [18] 0.08639241 0.3237154  1.0805712
 [19] 0.08639241 0.2883803  1.0805712
 [20] 0.07078059 0.3986928  1.0631808
 [21] 0.07078059 0.1887482  1.0631808
 [22] 0.06339662 0.3173178  1.0592159
 [23] 0.06339662 0.2116197  1.0592159
 [24] 0.10981013 0.3665493  0.9774648
 [25] 0.10981013 0.2928270  0.9774648
Copy the code