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

加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。