banner
andrewji8

Being towards death

Heed not to the tree-rustling and leaf-lashing rain, Why not stroll along, whistle and sing under its rein. Lighter and better suited than horses are straw sandals and a bamboo staff, Who's afraid? A palm-leaf plaited cape provides enough to misty weather in life sustain. A thorny spring breeze sobers up the spirit, I feel a slight chill, The setting sun over the mountain offers greetings still. Looking back over the bleak passage survived, The return in time Shall not be affected by windswept rain or shine.
telegram
twitter
github

Autogluon,一個神奇的 python 庫

今天給大家分享一個超強的 Python 庫,autogluon

https://github.com/autogluon/autogluon
AutoGluon 是一個用於深度學習的 AutoML 工具包,它可以自動執行端到端機器學習任務,使我們能夠通過幾行代碼實現強大的預測性能。
AutoGluon「可自動執行機器學習任務」,使你能夠在應用程序中輕鬆實現強大的預測性能。
初體驗
安裝 AutoGluon
我們可以直接使用 pip 來進行安裝。

pip install autogluon

加載數據集
可以通過 TabularDataset 來加載數據集。

from autogluon.tabular import TabularDataset, TabularPredictor
train_data = TabularDataset('https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv')
test_data = TabularDataset('https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv')

模型構建
使用該模型需要初始化「評估指標、因變量和存儲結果的目錄。」

在如下示例中,我們使用 f1 作為評估指標。因變量是 "class",模型被放入 "output_models" 文件夾中

evaluation_metric= "f1"
data_label= "class"
save_path= "output_models"
predictor = TabularPredictor(label='class').fit(train_data, time_limit=120)  # Fit models for 120s
leaderboard = predictor.leaderboard(test_data)
#創建預測器
predictor = TabularPredictor(label=data_label,path=save_path,eval_metric=evaluation_metric) 
predictor=predictor.fit(train_data)
predictor.leaderboard(silent=True)

下圖所示的排行榜可以讓你了解「所有模型的嘗試情況以及你在這些模型上獲得的分數。」

image
下面一起來看一下特徵重要性。

X = train_data 
Predictor.feature_importance(X)

image

所有已構建的模型都存儲在輸出文件夾 "output_models" 中。

image

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。