Weka關聯規則分析


購物籃分析:

Apriori算法:

參數設置:

1.car 如果設為真,則會挖掘類關聯規則而不是全局關聯規則。

2. classindex 類屬性索引。如果設置為-1,最后的屬性被當做類屬性。

3. delta 以此數值為迭代遞減單位。不斷減小支持度直至達到最小支持度或產生了滿足數量要求的規則。

4. lowerBoundMinSupport 最小支持度下界。

5. metricType 度量類型。設置對規則進行排序的度量依據。可以是:置信度(類關聯規則只能用置信度挖掘),提升度(lift),杠桿率(leverage),確信度(conviction)。

在 Weka中設置了幾個類似置信度(confidence)的度量來衡量規則的關聯程度,它們分別是:

a) Lift : P(A,B)/(P(A)P(B)) Lift=1時表示A和B獨立。這個數越大(>1),越表明A和B存在於一個購物籃中不是偶然現象,有較強的關聯度.

b) Leverage :P(A,B)-P(A)P(B)

Leverage=0時A和B獨立,Leverage越大A和B的關系越密切

c) Conviction:P(A)P(!B)/P(A,!B) (!B表示B沒有發生) Conviction也是用來衡量A和B的獨立性。從它和lift的關系(對B取反,代入Lift公式后求倒數)可以看出,這個值越大, A、B越關聯。

6. minMtric 度量的最小值。

7. numRules 要發現的規則數。

8. outputItemSets 如果設置為真,會在結果中輸出項集。

9. removeAllMissingCols 移除全部為缺省值的列。

10. significanceLevel 重要程度。重要性測試(僅用於置信度)。

11. upperBoundMinSupport 最小支持度上界。 從這個值開始迭代減小最小支持度。

12. verbose 如果設置為真,則算法會以冗余模式運行。

=== Run information ===

Scheme:       weka.associations.Apriori -N 10 -T 0 -C 0.9 -D 0.05 -U 1.0 -M 0.1 -S -1.0 -c -1
Relation:     basket
Instances:    940  // 有940條數據
Attributes:   11    // 有11 個字段
              fruitveg
              freshmeat
              dairy
              cannedveg
              cannedmeat
              frozenmeal
              beer
              wine
              softdrink
              fish
              confectionery
=== Associator model (full training set) ===


Apriori
=======

Minimum support: 0.1 (94 instances) // 最小支持率是0.1,最小需要94個實例
Minimum metric <confidence>: 0.9  //最小置信度為0.9
Number of cycles performed: 18   // 進行了18輪搜索

Generated sets of large itemsets:   //生成的頻繁項集

Size of set of large itemsets L(1): 22 //頻繁1項集:22

Size of set of large itemsets L(2): 171  // 頻繁2項集 171 個

Size of set of large itemsets L(3): 633

Size of set of large itemsets L(4): 992

Size of set of large itemsets L(5): 1130

Size of set of large itemsets L(6): 538

Size of set of large itemsets L(7): 143

Best rules found:  // 最好的10條規律

 1. cannedveg=F beer=F fish=T confectionery=F 118 ==> wine=F 109    conf:(0.92)
 2. freshmeat=F cannedveg=F beer=F fish=T confectionery=F 102 ==> wine=F 94    conf:(0.92)
 3. fruitveg=F freshmeat=F cannedveg=T softdrink=F 147 ==> dairy=F 135    conf:(0.92)
 4. freshmeat=F wine=T confectionery=F 117 ==> dairy=F 107    conf:(0.91)
 5. fruitveg=F freshmeat=F cannedveg=T wine=F softdrink=F 105 ==> dairy=F 96    conf:(0.91)
 6. fruitveg=F freshmeat=F cannedveg=T softdrink=F confectionery=F 113 ==> dairy=F 103    conf:(0.91)
 7. fruitveg=F freshmeat=F cannedveg=T cannedmeat=F softdrink=F 112 ==> dairy=F 102    conf:(0.91)
 8. fruitveg=F cannedveg=T softdrink=F confectionery=F 128 ==> dairy=F 116    conf:(0.91)
 9. fruitveg=F freshmeat=F cannedveg=T softdrink=F fish=F 117 ==> dairy=F 106    conf:(0.91)
10. fruitveg=F dairy=F cannedveg=T wine=F softdrink=F 106 ==> freshmeat=F 96    conf:(0.91)

 

結果含義:

cannedveg的值為F、 beer的值F、 fish的值為T 、 confectionery的值為F 118 的時候推出   wine的值為F 109,該關聯關系的置信度為0.92
FilteredAssociator
=== Run information ===

Scheme:       weka.associations.FilteredAssociator -F "weka.filters.MultiFilter -F \"weka.filters.unsupervised.attribute.ReplaceMissingValues \"" -c -1 -W weka.associations.Apriori -- -N 10 -T 0 -C 0.9 -D 0.05 -U 1.0 -M 0.1 -S -1.0 -c -1
Relation:     basket
Instances:    940
Attributes:   11
              fruitveg
              freshmeat
              dairy
              cannedveg
              cannedmeat
              frozenmeal
              beer
              wine
              softdrink
              fish
              confectionery
=== Associator model (full training set) ===

FilteredAssociator using weka.associations.Apriori -N 10 -T 0 -C 0.9 -D 0.05 -U 1.0 -M 0.1 -S -1.0 -c -1 on data filtered through weka.filters.MultiFilter -F "weka.filters.unsupervised.attribute.ReplaceMissingValues "

Filtered Header
@relation basket-weka.filters.unsupervised.attribute.ReplaceMissingValues-weka.filters.MultiFilter-Fweka.filters.unsupervised.attribute.ReplaceMissingValues

@attribute fruitveg {F,T}
@attribute freshmeat {F,T}
@attribute dairy {F,T}
@attribute cannedveg {F,T}
@attribute cannedmeat {F,T}
@attribute frozenmeal {F,T}
@attribute beer {F,T}
@attribute wine {F,T}
@attribute softdrink {F,T}
@attribute fish {F,T}
@attribute confectionery {F,T}

@data


Associator Model

Apriori
=======

Minimum support: 0.1 (94 instances)
Minimum metric <confidence>: 0.9
Number of cycles performed: 18

Generated sets of large itemsets:

Size of set of large itemsets L(1): 22

Size of set of large itemsets L(2): 171

Size of set of large itemsets L(3): 633

Size of set of large itemsets L(4): 992

Size of set of large itemsets L(5): 1130

Size of set of large itemsets L(6): 538

Size of set of large itemsets L(7): 143

Best rules found:

 1. cannedveg=F beer=F fish=T confectionery=F 118 ==> wine=F 109    conf:(0.92)
 2. freshmeat=F cannedveg=F beer=F fish=T confectionery=F 102 ==> wine=F 94    conf:(0.92)
 3. fruitveg=F freshmeat=F cannedveg=T softdrink=F 147 ==> dairy=F 135    conf:(0.92)
 4. freshmeat=F wine=T confectionery=F 117 ==> dairy=F 107    conf:(0.91)
 5. fruitveg=F freshmeat=F cannedveg=T wine=F softdrink=F 105 ==> dairy=F 96    conf:(0.91)
 6. fruitveg=F freshmeat=F cannedveg=T softdrink=F confectionery=F 113 ==> dairy=F 103    conf:(0.91)
 7. fruitveg=F freshmeat=F cannedveg=T cannedmeat=F softdrink=F 112 ==> dairy=F 102    conf:(0.91)
 8. fruitveg=F cannedveg=T softdrink=F confectionery=F 128 ==> dairy=F 116    conf:(0.91)
 9. fruitveg=F freshmeat=F cannedveg=T softdrink=F fish=F 117 ==> dairy=F 106    conf:(0.91)
10. fruitveg=F dairy=F cannedveg=T wine=F softdrink=F 106 ==> freshmeat=F 96    conf:(0.91)

 

 這個結論和上面的一樣就不寫了

Tertius

 

=== Run information ===

Scheme: weka.associations.Tertius -K 10 -F 0.0 -N 1.0 -L 4 -G 0 -c 0 -I 0 -P 0
Relation: basket
Instances: 940
Attributes: 11
fruitveg
freshmeat
dairy
cannedveg
cannedmeat
frozenmeal
beer
wine
softdrink
fish
confectionery
=== Associator model (full training set) ===


Tertius
=======

1. /* 0.433417 0.022340 */ frozenmeal = F ==> cannedveg = F or beer = F
2. /* 0.427294 0.028723 */ beer = F ==> cannedveg = F or frozenmeal = F
3. /* 0.426433 0.025532 */ cannedveg = F ==> frozenmeal = F or beer = F
4. /* 0.394573 0.015957 */ dairy = F and frozenmeal = T and beer = T ==> cannedveg = T
5. /* 0.388260 0.019149 */ dairy = F and cannedveg = T and beer = T ==> frozenmeal = T
6. /* 0.382993 0.019149 */ beer = F ==> cannedveg = F or frozenmeal = F or softdrink = T
7. /* 0.382471 0.017021 */ frozenmeal = F ==> cannedveg = F or beer = F or softdrink = T
8. /* 0.380465 0.025532 */ dairy = F and cannedveg = T and frozenmeal = T ==> beer = T
9. /* 0.376718 0.017021 */ cannedveg = F ==> frozenmeal = F or beer = F or confectionery = T
10. /* 0.374939 0.018085 */ frozenmeal = F ==> cannedveg = F or beer = F or confectionery = T

Number of hypotheses considered: 43952
Number of hypotheses explored: 22282

 結論:

英語版的(英語好的請自己翻譯后回復一下):

1. /* 0.433417 0.022340 */ frozenmeal = F ==> cannedveg = F or beer = F

The first number given with the rules is the confirmation value, and the second number is the frequency of counter-instances.
The “number of hypotheses considered” is the number of rules generated with the refinement operator.
The “number of hypotheses explored” is the number of rules that were “potentially interesting” and were considered for adding to the results or refining.

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM