栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

AutoGluon尝试,python

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

AutoGluon尝试,python

官方文档:AutoGluon: AutoML for Text, Image, and Tabular Data — AutoGluon Documentation 0.4.2 documentation

Github: GitHub - awslabs/autogluon: AutoGluon: AutoML for Image, Text, and Tabular Data

AutoGluon安装

关于选择CPU还是GPU,参考:Which underlying libraries of AutoGluon uses GPU for training? · Issue #262 · awslabs/autogluon · GitHub这里我选的是CPU

安装anaconda并在对应虚拟环境中运行以下命令:

pip3 install -U pip
pip3 install -U setuptools wheel

# CPU version of pytorch has smaller footprint - see installation instructions in
# pytorch documentation - https://pytorch.org/get-started/locally/
pip3 install "torch>=1.0,<1.11+cpu" -f https://download.pytorch.org/whl/cpu/torch_stable.html

pip3 install autogluon
数据集准备

我有很多年的空间数据,所以在整理时借助了postgresql数据库,参考之前的文章 Python和PostgreSQL,PostGIS,空间数据管理_balabalaxi~的博客-CSDN博客

最终导出了一个csv文件

 样本处理

拿到一堆训练数据,在选择训练集,交叉验证集和测试集时往往需要把数据的顺序打乱,可以采用以下方法:

1.df.sample(frac=1)

该方法会对df打乱顺序,并返回一定的比例,其中若100%返回则frac=1, 若返回50%则frac=0.5。然后对数据集进行分割即可:

df=df.sample(frac=1)
df=df.sample(frac=0.5)
transet=df.loc[:a] # 提取数据前a行
2.使用sklearn(机器学习的库)中的shuffle
from sklearn.utils import shuffle
df = shuffle(df)
3.使用numpy中的shuffle
df.iloc[np.random.permutation(len(df))]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/971785.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号