【新智元導(dǎo)讀】近期,Kaggle發(fā)布了新的數(shù)據(jù)分析及可視化工具——Kaggle Kerneler bot,用戶(hù)只需上傳數(shù)據(jù)集,便可用Python為用戶(hù)自動(dòng)獲取相關(guān)的深度數(shù)據(jù)分析結(jié)果。本文將帶領(lǐng)讀者體驗(yàn)一下這款便捷而又高效的工具。
Kaggle Kerneler bot是一個(gè)自動(dòng)生成的kernel,其中包含了演示如何讀取數(shù)據(jù)以及分析工作的starter代碼。用戶(hù)可以進(jìn)入任意一個(gè)已經(jīng)發(fā)布的項(xiàng)目,點(diǎn)擊頂部的“Fork Notebook”來(lái)編輯自己的副本。接下來(lái),小編將以最熱門(mén)的兩個(gè)項(xiàng)目作為例子,帶領(lǐng)讀者了解該如何使用這款便捷的工具。
好的開(kāi)始是成功的一半!
要開(kāi)始這個(gè)探索性分析(exploratory analysis),首先需要導(dǎo)入一些庫(kù)并定義使用matplotlib繪制數(shù)據(jù)的函數(shù)。但要注意的是,并不是所有的數(shù)據(jù)分析結(jié)果圖像都能夠呈現(xiàn)出來(lái),這很大程度上取決于數(shù)據(jù)本身(Kaggle Kerneler bot只是一個(gè)工具,不可能做到Jeff Dean或者Kaggle比賽選手們那么完美的結(jié)果)。
In [1]:
frommpl_toolkits.mplot3dimportAxes3Dfromsklearn.decompositionimportPCAfromsklearn.preprocessingimportStandardScalerimportmatplotlib.pyplotasplt#plottingimportnumpyasnp#linearalgebraimportos#accessingdirectorystructureimportpandasaspd#dataprocessing,CSVfileI/O(e.g.pd.read_csv)
在本例中,一共輸入了12個(gè)數(shù)據(jù)集。
In [2]:
print(os.listdir('../input'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/007_nagato_yuki'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/046_alice_margatroid'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/065_sanzenin_nagi'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/080_koizumi_itsuki'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/096_golden_darkness'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/116_pastel_ink'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/140_seto_san'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/144_kotegawa_yui'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/164_shindou_chihiro'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/165_rollo_lamperouge'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/199_kusugawa_sasara'))print(os.listdir('../input/moeimouto-faces/moeimouto-faces/997_ana_coppola'))
接下里,用戶(hù)在編輯界面中會(huì)看到四個(gè)已經(jīng)編好的代碼塊,它們定義了繪制數(shù)據(jù)的函數(shù)。而在發(fā)布后的頁(yè)面,這些代碼塊會(huì)被隱藏,如下圖所示,只需單擊已發(fā)布界面中的“code”按鈕就可以顯示隱藏的代碼。
準(zhǔn)備就緒!讀取數(shù)據(jù)!
首先,讓我們先看一下輸入中的第一個(gè)數(shù)據(jù)集:
In [7]:
nRowsRead = 100 # specify ‘None’ if want to read whole file# color.csv may have more rows in reality, but we are only loading/previewing the first 100 rowsdf1 = pd.read_csv(‘。。/input/moeimouto-faces/moeimouto-faces/080_koizumi_itsuki/color.csv’, delimiter=‘,’, nrows = nRowsRead)df1.dataframeName = ‘color.csv’nRow, nCol = df1.shapeprint(f‘There are {nRow} rows and {nCol} columns’)
那么數(shù)據(jù)長(zhǎng)什么樣子呢?
In [8]:
df1.head(5)
Out [8]:
數(shù)據(jù)可視化:僅需簡(jiǎn)單幾行!
樣本的柱狀圖:
In [9]:
plotHistogram(df1, 10, 5)
二維和三維的PCA圖:
In [10]:
plotPCA(df1, 2) # 2D PCAplotPCA(df1, 3) # 3D PCA
同理,更換數(shù)據(jù)集文件的路徑,也可以得到其它數(shù)據(jù)對(duì)應(yīng)的結(jié)果。
當(dāng)然,除了上述幾種可視化的結(jié)果外,根據(jù)輸入數(shù)據(jù)以及需求的不同,也可以得到其它數(shù)據(jù)分析可視化結(jié)果,例如:
相關(guān)矩陣:
In [11]:
plotCorrelationMatrix(df1, 8)
散射和密度圖:
In [12]:
plotScatterMatrix(df1, 20, 10)
針對(duì)數(shù)據(jù)分析、數(shù)據(jù)可視化工作,Kaggle kerneler bot應(yīng)當(dāng)說(shuō)是相當(dāng)?shù)谋憬莺透咝Я?。那么你是否也想嘗試一下呢?
-
可視化
+關(guān)注
關(guān)注
1文章
1219瀏覽量
21425 -
數(shù)據(jù)分析
+關(guān)注
關(guān)注
2文章
1467瀏覽量
34556
原文標(biāo)題:Kaggle放大招:簡(jiǎn)單幾步實(shí)現(xiàn)海量數(shù)據(jù)分析及可視化
文章出處:【微信號(hào):AI_era,微信公眾號(hào):新智元】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
七款經(jīng)久不衰的數(shù)據(jù)可視化工具!
為更快讀懂報(bào)表,我們將數(shù)據(jù)可視化了
只有報(bào)表直觀了,不能算真正的數(shù)據(jù)可視化
能做數(shù)據(jù)治理的數(shù)據(jù)可視化工具,又快又靈活
現(xiàn)在做企業(yè)級(jí)數(shù)據(jù)分析,離不開(kāi)秒分析的數(shù)據(jù)可視化工具
請(qǐng)問(wèn)怎么把BI數(shù)據(jù)可視化報(bào)表發(fā)給領(lǐng)導(dǎo)看?
一般圖表做不了的分析,BI數(shù)據(jù)可視化圖表可以
什么樣的數(shù)據(jù)分析軟件能讓全員自助可視化分析更絲滑?
奧威BI數(shù)據(jù)可視化軟件|讓業(yè)務(wù)獨(dú)立自主分析
SpeedBI數(shù)據(jù)可視化工具:瀏覽器上做分析
財(cái)務(wù)數(shù)據(jù)分析?奧威BI數(shù)據(jù)可視化工具很擅長(zhǎng)
千人千面的數(shù)據(jù)分析有沒(méi)可能?奧威BI數(shù)據(jù)可視化工具告訴你
可視化策略的數(shù)據(jù)分析

評(píng)論