[資料探勘Project1報告](https://hackmd.io/09PgZ0R3SMeoWHyLQZCbqQ) === ## Aprior 與 FP-Growth 比較 **aprior** 與 **fp-growth** 最大差異在於運算時間,在大致相同的條件下(min_support, min_confidence), **fp-growth** 運算時間明顯**小於** **aprior**。 |**aprior**|**fp-growth**| |:---:|:---:| |![123](https://i.imgur.com/IajO8VV.png)|![](https://i.imgur.com/RdLSte0.png) 原因在於 **fp-growth** 不用一直重複尋訪整個資料庫(databaser or dataset),利用 **fp-tree** 減少尋訪資料的時間。 |![](https://i.imgur.com/KHeWHC3.png)| |:---:| |**fp-tree**| --- ## support 與 confidence || 低 **support** | 高 **support** | |---|---|---| |低 **confidence**|表示各item很少出現在所有transcation,且這些item很少會出現在同一筆transcation中。|表示各item很常出現在所有transcation中,但這些item很少出現在同一筆transcation中。| |高 **confidence**|表示各item很少出現在所有transcation,但這些item很常會出現在同一筆transcation中。|表示各item很常出現在所有transcation中,且這些item很常出現在同一筆transcation中。| 換句話說... ||低|高| |---|---|---| |support|item總出現次數低|item總出現次數高| |confidence|item不容易一起出現|item容易一起出現| --- ## 測試案例-Acute Inflammations Data Set(急性發炎) * [資料集來源](http://archive.ics.uci.edu/ml/datasets/Acute+Inflammations) * 摘要:該數據由醫學專家創建,作為測試專家系統的數據集,該系統將對泌尿系統的兩種疾病進行推定診斷 * Attribute: 1. **Temperature of patient** { 35C-42C } 體溫。 <=37.5: A, >37.5: B 2. **Occurrence of nausea** { yes, no } 噁心。 yes: C, no: D 3. Lumbar pain { yes, no } 腰痛。 yes: E, no: F 4. **Urine pushing (continuous need for urination)** { yes, no } 利尿。 yes: G, no: H 5. **Micturition pains** { yes, no } 排尿痛。 yes: I, no: J 6. **Burning of urethra, itch, swelling of urethra outlet** { yes, no } 尿道灼燒、發癢、尿道口腫脹。 yes: K, no: L 7. **decision: Inflammation of urinary bladder** { yes, no } 膀胱發炎。 yes: M, no: N 8. **decision: Nephritis of renal pelvis origin** { yes, no } 腎炎。 yes: O, no: P - (1.)~(6.)為症狀;(7.)、(8.)為疾病。 |![](https://i.imgur.com/vC0L6ma.png)|![](https://i.imgur.com/ZpbgUOZ.png)| |:---:|:---:| |**資料集**|**結果**| ### 結果分析 > 因為是要預測某原因是否會產生其他附帶原因或疾病,因此將 **min_confidence** 設較高(=0.8)。 1. 在高 **min_support** (=7)的情況下,大部分的關聯規則皆顯示:若沒有(2.)~(6.)的症狀,就不會有(7.)、(8.)的問題;但其中一條規則顯示 ![](https://i.imgur.com/Glp8eyV.png) 你經常利尿,就要小心是否是膀胱發炎。 2. 在 **min_support** (=6)的情況下,可以整理出以下幾點猜測: - 若帶有(7.)或(8.)的疾病,**通常**都伴隨至少1~2項的症狀。 - 即使沒有症狀,還是**低機率**帶有(7.)或(8.)的疾病。 - 疾病或症狀的發生與病人的**體溫**幾乎**沒有**關聯。 --- ## 測試案例-ibm-2021 * 測試演算法: Aprior Algorithm * min_support: 0.2152335 * min_confidence: 1.42892 結果: * [rule count](https://drive.google.com/file/d/17cVFWjcK1jdA4svcWt9V_DCMoPFcc1oh/view?usp=sharing): 1501 * time cost: 1.38069's