2. clustering and association rule mining
- 2. 課程大綱 (1/2)
1. 認識Weka
2. Weka的資料來源
3. 準備Weka:
下載、安裝與設定
4. 認識Weka架構
2
Chapter 1.
認識Weka
5. 探索性分析:分群
6. 探索性分析:異常偵測
7. 比較性分析:
關聯規則探勘
Chapter 2.
探索性與比較性分析
- 19. 1. 下載與開啟檔案
2. 資料前處理:
a. 關閉目標屬性
b. NominalToBoolean
3. 執行分群:AddCluster →
CascadeSimpleKMeans
4. 檢視探勘結果:
Weka分群結果分析器
19
探索性分析:分群
實作步驟
- 22. STEP 1. 下載與開啟檔案 (3/4)
2. Look in:
移動到下載資料夾
3. Files of Type:
ODF Spreadsheets
(*.ods)
開啟ODF檔案類型
※ 需安裝套件WekaODF
4. 選擇檔案
stu-sch-1 - train.ods
5. Open 開啟檔案
22
2
3
4
5
- 27. 27
STEP 2b. 資料前處理
類別轉虛擬變項 (1/5)
1. 按Filter 底下的 Choose
選擇篩選器
2. 找到篩選器
weka.filters.unsupervised
.attribute.NominalToBinary
1
2
- 28. 28
STEP 2b. 資料前處理
類別轉虛擬變項 (1/5)
1. 按Filter 底下的 Choose
選擇篩選器
2. 找到篩選器
weka.filters.unsupervised
.attribute.NominalToBinary
用錄影示範操作吧!
- 33. 33
STEP 2b. 資料前處理
類別轉虛擬變項 (5/5)
7. Attributes: 56
屬性數量增加
從30變成56個
8. 類別型屬性Gender
被轉換成兩個數值
型屬性
a. Gender=female
b. Gender=male
8
7
- 34. 34
STEP 3. 執行分群 (1/7)
1. Filter ⇨ Choose
選擇篩選器
weka.filters.unsupervised
.attribute.AddCluster
1
- 35. STEP 3. 執行分群 (2/7)
2. 按下粗體字的篩選器
名稱
AddCluster
開啟進階設定
35
2
- 36. STEP 3. 執行分群 (3/7)
3. 將
clusterer
分群演算法選擇
weka.clusterers
.CascadeSimpleKMeans
4. OK 離開進階設定
※ 需安裝套件cascadeKMeans
36
4
3
- 37. STEP 3. 執行分群 (4/7)
5. 按粗體字
CascadeSimpleKMeans
開啟進階設定
37
- 38. STEP 3. 執行分群 (5/7)
在maxNumClusters跟
minNumClusters裡面可以
設定最多和最少的分群數量。
預設值會讓分群數量介於2至
10之間。
如果沒有特別要修改的話,
6. OK 離開進階設定
38
6
!
- 40. STEP 3. 執行分群 (7/7)
8. Attributes: 57
屬性數量增加
從56變成57個
9. 新增了cluster類別型
屬性
10.所有資料被分成兩群
cluster1: 共252筆
cluster2: 共333筆
40
7
8
6
- 42. STEP 4. 檢視探勘結果 (2/6)
2. Look in:
移動到下載資料夾
3. File Name 檔案命名
stu-sch-1 - train -cluster.csv
2. Files of Type:
CSV file: comma
separated files (*.csv)
以CSV檔案類型儲存
3. Save 儲存檔案
此資料夾就會產生
CSV檔案
42
2
4
5
stu-sch-1
- train - cluster.csv
3
- 44. STEP 4. 檢視探勘結果 (4/6)
6. 選擇檔案
選擇剛剛儲存的
CSV檔案
44
6
stu-sch-1
- train - cluster.csv
- 45. STEP 4. 檢視探勘結果 (6/6)
7. 分群比較表
查看各分群大於
和小於全部資料
均值的屬性
8. 舉例:
● 第2群的Age大於
平均值
● 表示第2群的年齡
較大
45
7
8
- 46. STEP 4. 檢視探勘結果 (6/6)
9. 分群結果
查看各屬性在
各群中的平均
值和標準差
10.舉例:
● 第2群的Age大
於平均值為16.8
● 比第1群的16.6
還要大一點
46
9
10
- 62. 62
STEP 3. 執行異常偵測 (1/3)
1. Filter ⇨ Choose
選擇篩選器
weka.filters.unsupervised
.attribute.LOF
※ 需安裝套件localOutlierFactor
1
- 64. 64
STEP 3. 執行異常偵測 (3/3)
4
53
3. Attributes: 31
屬性數量增加
從30變成31個
4. 新增了LOF數值型屬
性
5. 查看LOF資料分佈
○ 最小值 0.983
○ 最大值 1.25
- 66. 66
STEP 4. 檢視探勘結果 (2/7)
2. Look in:
移動到下載資料夾
3. File Name: 檔案命名
stu-sch-2 - train - lof.ods
2. Files of Type:
ODF Spreadsheets (*.ods)
以ODS檔案類型儲存
3. Save 儲存檔案
此資料夾就會產生ODS
檔案
2
5
3
4
stu-sch-1
- train - lof.ods
- 70. STEP 4. 檢視探勘結果 (5/7)
8. Data
開啟資料的功能群組頁籤
9. AutoFilter
啟動自動篩選功能
70
8
9
- 71. STEP 4. 檢視探勘結果 (6/7)
10.找到最後一個直欄
LOF
點下右邊的下拉選單
按鈕
11.選擇排序
○ Sort Ascending
由小到大排序
○ Sort Descending
由大到小排序
71
10 11
- 80. 𝑝 維度空間超立方範圍 𝑩𝑖 = 𝑺
這是資料中所有可能的組成範圍,要如何找到最適合的超立方範圍B呢?
80
熱點分析
演算法流程 (1/6)
(Trainor, 2014)
🔴 目標屬性=目標值
⬛ 目標屬性≠目標值
- 88. 因病退伍 = Yes 心理疾病 = Yes
信賴度= 0.8
Metric Type
評估指標
88
熱點分析的評估指標
信賴度(2/2)
http://www.ntdtv.com.tw/b5/20160511/video/171381.html?ptt
- 97. STEP 2. 執行關聯規則探勘 (2/6)
3. Associator ⇨ Choose
選擇關聯規則探勘演算法
weka.associations
.HotSpot
※ 需安裝套件hotSpot
97
3
- 99. STEP 2. 執行關聯規則探勘 (4/6)
5. 請設定以下參數:
maxBranchingFactor: 30
屬性分支最大值,請輸入屬性數量
maxRuleLength: 1
規則長度最大值
outputRules: True
顯示關聯規則
target: last
目標屬性最後一項(School)
targetIndex: first
目標值的索引 (第一個=GP)
5. OK 離開進階設定
99
6
5
- 100. STEP 2. 執行關聯規則探勘 (5/6)
7. Start 開始執行
8. Result list
增加新的探勘結果
9. Associator output
探勘結果細節
100
7
8
9
Editor's Notes
- 課程編輯網頁
https://docs.google.com/document/d/1XiSkOSbaqEzFC7X_-Q1FewS-9Hhw2a_pjGfKv9uGvMI/edit#
W14 分類與預測:貝氏網路
https://docs.google.com/presentation/d/1fXzH2xWUigsy8bD8usxrO4V9fPW8xjAdtEHU6_Jui3A/edit?usp=sharing
文本探勘
http://l.pulipuli.info/19/ncku-tm
活動說明網頁
https://docs.google.com/document/d/1QuApzboOkpHZjEBe0Q7uruOqh6xlDB4sHNIXVZ9oQdk/edit
90分鐘+90分鐘
13:00 - 14:30
WEKA簡介與實作-1
陳勇汀 老師/
洪麗娟 督導長
開放(內含儲備資訊護理師6名)
14:30 - 14:40
休息
14:40 - 16:20
WEKA簡介與實作-2
陳勇汀 老師/
洪麗娟 督導長
開放(內含儲備資訊護理師6名)
- 如何探索資料
的共同模式?
- https://docs.google.com/presentation/d/1_8_AqCxImQZ1-3pOXqLcMMwPVZXPzFC6gu47U0MTLrg/edit#slide=id.g1d4436ec24_1_2338
- https://docs.google.com/presentation/d/1HYPmm0dWobeKUx1j0EEtsrEtuicFHRh4oMWvZHCafL4/edit#slide=id.g5b2b5e5bb9_15_536
https://www.wikiwand.com/en/Local_outlier_factor
LOF = 相較於它周圍的鄰居,
它異常的程度
- https://docs.google.com/presentation/d/1HYPmm0dWobeKUx1j0EEtsrEtuicFHRh4oMWvZHCafL4/edit#slide=id.g5b2b5e5bb9_15_536
https://www.wikiwand.com/en/Local_outlier_factor
- https://gfycat.com/gentlequestionableflyingsquirrel
- :關聯規則探勘
- school - student's school (binary: 'GP' -
Gabriel Pereira
https://www.pinterest.com/pin/566327721862405642/?lp=true
or 'MS' -
Mousinho da Silveira
https://www.parque-escolar.pt/en/school/027
- http://clipart-library.com/clipart/teacher-clip-art-13.htm
- http://blog.pulipuli.info/2017/08/wekahotspot-association-rule-mining.html
https://www.vectorstock.com/royalty-free-vector/baby-diaper-icon-flat-style-vector-7902069
https://www.vectorstock.com/royalty-free-vector/beer-bottle-template-in-modern-flat-style-icon-on-vector-14974267
- https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4718587/
Patient Rule Induction Method (PRIM)
- theta
- theta
- https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4718587/
Patient Rule Induction Method (PRIM)
- http://blog.pulipuli.info/2017/08/wekahotspot-association-rule-mining.html
- http://blog.pulipuli.info/2017/08/wekahotspot-association-rule-mining.html
- https://docs.google.com/document/d/1-89iOSo4okqoKnuzPZSx8uAcxFqBlFgY7fY5kvr6Azg/edit#heading=h.rr8om137luf
- http://www.shujuren.org/article/827.html