iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 10
0
AI & Data

跟top kaggler學習如何贏得資料分析競賽 系列 第 10

[Day 10] Visualizations / 視覺化

先說點時事, 今天凌晨有 iPhone 11 發表會, 為了 AI 有新增一個 Core ML 庫可讓開發者調用. 回到 kaggle 比賽的準備.

EDA 是工具知識的基礎, 視覺化可以幫助我們理出資料中有趣的線索, 視覺化工具有兩類

- 探索個別的特徵

  1. 直方圖 Histogram (基本且萬用)
  2. 各式圖表 Plots
  3. 統計 Statistics

直方圖 Histogram

https://ithelp.ithome.com.tw/upload/images/20190911/20108719TwOeJKJt6G.png
截圖自coursera

plt.hist(x)

各式圖表 plot (index vs feature statisics)

https://ithelp.ithome.com.tw/upload/images/20190911/20108719mGGXU78ARu.png
截圖自coursera

plt.plot(x,'.')

各式圖表 Plots, 以散布圖 Scatter plots為例

https://ithelp.ithome.com.tw/upload/images/20190911/201087190GgxAp17nC.png
截圖自coursera

plt.scatter(range(len(x)), x, c=y)

散布圖 Scatter plots進階版 -1
https://ithelp.ithome.com.tw/upload/images/20190911/20108719bVD6oIhmb4.png
截圖自coursera

plt.scatter_matrix(df)

散布圖 Scatter plots進階版 -2 (加相關性)
2-1 配對 (還是很亂.., 請看2-2)
https://ithelp.ithome.com.tw/upload/images/20190911/20108719cYXaaikw7F.png


2-2 配對/群組
https://ithelp.ithome.com.tw/upload/images/20190911/20108719YdFyju6lkM.png
截圖自coursera

df.corr(), plt.matshow(...)

群組
https://ithelp.ithome.com.tw/upload/images/20190911/20108719TXfqljeuFR.png
截圖自coursera

df.mean(). plot(style='.')

改良版群組
https://ithelp.ithome.com.tw/upload/images/20190911/20108719P8KQSKMm1f.png
截圖自coursera

df.mean(). sort_value().plot(style='.')

統計 Statistics

https://ithelp.ithome.com.tw/upload/images/20190911/20108719uMI8M8kYcO.png
截圖自coursera

df.describe()
x.mean
x.var

缺值

https://ithelp.ithome.com.tw/upload/images/20190911/20108719S79aIDbYiG.png
截圖自coursera

x.value_counts()
x.isnull()

- 探索特徵間的關係

配對 / pairs
1. 散布圖 Scatter plots
2. 散布矩陣 Scatter matrix
3. 相關圖 Corrplot
群組 / group
1. 相關圖+集群 Correlation plots + clustering
2. 圖表 plot (index vs feature statisics)
3. 還有很多


散布圖 Scatter plots :

灰色是 test set, 若彩色(class 0, class 1)與灰色交雜是ok的, 但是右上角一大片只有灰點, 表示 test set 不妙.
https://ithelp.ithome.com.tw/upload/images/20190911/20108719dQD5cD0Vt2.png
截圖自coursera

plt.scatter(x1, x2)

上一篇
[Day 9] Anonymized data 匿名資料
下一篇
[Day 11] 資料清理及補充資料連結 / Dataset cleaning and additional materials and links
系列文
跟top kaggler學習如何贏得資料分析競賽 30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言