iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 11
0
Everything on Azure

Azure Machine Learning Studio系列 第 11

Azure Machine Learning Studio 資料前處理 - 替換離散值 Replace Discrete Values

Replace Discrete Values 通常用在兩個變數間,計算結果有兩種:

  1. 若 B 欄位屬於 categorical value 分類變量,會計算:
    • P(B|A),也就是在 A 欄位為某值的條件下,B 欄位發生的條件機率值
  2. 若 B 欄位屬於 non-categorical value 非分類變量,會計算:
    • Mean(B|A),也就是 A 欄位為某值時,B 欄位的平均值
    • Std-Dev(B|A),也就是 A 欄位為某值時,B 欄位的標準差

https://ithelp.ithome.com.tw/upload/images/20181024/20111935GaiVZDIrkK.png

Replace Discrete Values 替換離散值

位置:Statistical Functions / Replace Discrete Values

  1. 新增 Automobile price data 汽車價格資料集,新增 Select Columns in Dataset,將資料集輸出接至 Select Columns in Dataset,點選右手邊 Launch column selector 開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935b2lzPMcVXF.png

  2. 選擇 num-of-doors 幾門、curb-weight 淨重 這兩個欄位,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935jX0H939ABR.png

  3. 執行欄位篩選
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935m8RyGSLdeX.png

  4. 新增 Edit Metadata 編輯資料,將資料集篩選結果接至 Edit Metadata,點選右手邊 Launch column selector開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935CT4jQaOeTO.png

  5. 選擇 curb-weight 淨重 欄位,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935RsACUmfWTP.png

  6. 選擇 Make categorical 將此欄位設定為分類變量,接著執行此編輯
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935gkQAntl6xr.png

  7. 新增 Replace Discrete Values 替換離散值,將編輯資料執行後的結果輸出接至 Replace Discrete Values ,右手邊 Discrete columns 點選 Launch column selector 開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935puB6TCm9E1.png

  8. 選擇 curb-weight 淨重 欄位,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935tsXykRoHlA.png

  9. 右手邊第二個欄位 Replacement columns 點選 Launch column selector 開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935M9mKt4R2mI.png

  10. 選擇 num-of-doors 幾門欄位,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935KKZpYGX3VE.png

  11. 執行計算
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935UNpRFTJvkt.png

  12. 點選 Visualize 檢視計算結果
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935LnXvdEuD3o.png

  13. 可以看到計算結果為 P(num-of-doors|curb-weight),代表當車子淨重為 XXX 的條件下,車子是幾門的機率值,以下圖為例:

  • 第 1 筆代表車子淨重為 2548 的條件下,車子為雙門的機率 100%
  • 第 11 筆代表車子淨重 2395 的條件下,車子為雙門的機率 50%、為四門的機率 50%

https://ithelp.ithome.com.tw/upload/images/20181024/20111935XwtNvvoSGV.png

  1. 接著看另一種情況,再拖曳一個 Edit Metadata 編輯資料,將資料集接至 Edit Metadata,點選右手邊 Launch column selector 開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935Qcu1yh8nvs.png

  2. 選擇 num-of-doors 幾門 欄位,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935lcJLlJCly2.png

  3. 一樣選擇 Make categorical,接著執行此編輯
    https://ithelp.ithome.com.tw/upload/images/20181024/201119353VSM0Dm2yj.png

  4. 新增 Replace Discrete Values 替換離散值,將編輯資料結果輸出接至 Replace Discrete Values,右手邊 Discrete columns 點選 Launch column selector 開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935VEyBxXNBPr.png

  5. 選擇 num-of-doors 幾門,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/201119354sFFLGKjAY.png

  6. Replacement columns 點選 Launch column selector 開啟欄位選擇工具
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935TOoGgIqSF6.png

  7. 選擇 curb-weight 淨重欄位,點選右下角勾勾確認
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935qHixKaY2NK.png

  8. 執行計算
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935U0Xl481F4e.png

  9. 點選 Visualize 檢視計算後結果
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935yG3z5mUyNr.png

  10. 當 Replace Discrete Values 要計算的欄位為 non-categorical 非分類變量時,它就不會去計算條件機率值了,會計算欄位 A 為某值的情況下,欄位 B 的平均數及標準差
    https://ithelp.ithome.com.tw/upload/images/20181024/20111935QIQ54uMIv9.png

以上圖為例,會計算以下兩個結果:

  • Mean( curb-weight | num-of-doors ):幾門車子淨重的平均值
  • Std-Dev( curb-weight | num-of-doors ):幾門車子淨重的標準差

所以計算結果為:

  • Mean(淨重|雙門) = 2442.47191 (雙門車子淨重平均值)
  • Mean(淨重|四門) = 2648.04386 (四門車子淨重平均值)
  • Std-Dev(淨重|雙門) = 495.576117 (雙門車子淨重標準差)
  • Std-Dev(淨重|四門) =523.057231 (四門車子淨重標準差)

上一篇
Azure Machine Learning Studio 資料前處理 - 計算線性相關 Compute Linear Correlation
下一篇
Azure Machine Learning Studio 資料前處理 - 評估機率函數 Evaluate Probability Function
系列文
Azure Machine Learning Studio30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言