官方文档: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))]



