AutoGluon: AutoML for Text, Image, and Tabular Data¶
AutoGluon enables easy-to-use and easy-to-extend AutoML with a focus on automated stack ensembling, deep learning, and real-world applications spanning image, text, and tabular data. Intended for both ML beginners and experts, AutoGluon enables you to:
Quickly prototype deep learning and classical ML solutions for your raw data with a few lines of code.
Automatically utilize state-of-the-art techniques (where appropriate) without expert knowledge.
Leverage automatic hyperparameter tuning, model selection/ensembling, architecture search, and data processing.
Easily improve/tune your bespoke models and data pipelines, or customize AutoGluon for your use-case.
Note
Example using AutoGluon to train and deploy a high-performance model on a tabular dataset:
>>> 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')
>>> predictor = TabularPredictor(label='class').fit(train_data=train_data)
>>> predictions = predictor.predict(test_data)
AutoGluon can be applied just as easily for prediction tasks with image or text data.
Installation¶
Note
AutoGluon requires Python version 3.7, 3.8, or 3.9. For troubleshooting the installation process, you can check the Installation FAQ.
Select your preferences below and run the corresponding install commands:
OS: Linux Mac Windows
Version: PIP Source
Backend: CPU GPU
Command:
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.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip3 install autogluon
pip3 install -U pip
pip3 install -U setuptools wheel
pip3 install autogluon
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.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
git clone https://github.com/awslabs/autogluon
cd autogluon && ./full_install.sh
pip3 install -U pip
pip3 install -U setuptools wheel
git clone https://github.com/awslabs/autogluon
cd autogluon && ./full_install.sh
Note
If you don’t have them, please first install: XCode, Homebrew, LibOMP. Once you have Homebrew, LibOMP can be installed via:
# brew install wget
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb
# Uninstall libomp if it was previous installed
# brew uninstall libomp
brew install libomp.rb
rm libomp.rb
WARNING: Do not install LibOMP via “brew install libomp” as LibOMP 12 and 13 can cause segmentation faults with LightGBM and XGBoost.
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.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip3 install autogluon
Note
GPU usage is not yet supported on Mac OSX, please use Linux or Windows to utilize GPUs in AutoGluon.
Note
If you don’t have them, please first install: XCode, Homebrew, LibOMP. Once you have Homebrew, LibOMP can be installed via:
# brew install wget
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb
# Uninstall libomp if it was previous installed
# brew uninstall libomp
brew install libomp.rb
rm libomp.rb
WARNING: Do not install LibOMP via “brew install libomp” as LibOMP 12 and 13 can cause segmentation faults with LightGBM and XGBoost.
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.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
git clone https://github.com/awslabs/autogluon
cd autogluon && ./full_install.sh
Note
GPU usage is not yet supported on Mac OSX , please use Linux or Windows to utilize GPUs in AutoGluon.
Note
If you run into difficulties installing AutoGluon on Windows, please provide details in this GitHub Issue.
Note: ObjectDetector and any model that uses MXNet is not supported on Windows! GPU-based MXNet is not supported on Windows, and it is recommended to use Linux instead for these models.
To install AutoGluon on Windows, it is recommended to use Anaconda:
- Install Anaconda
If Anaconda is already installed but is an old version, follow this guide to update
Open Anaconda Prompt (anaconda3)
Inside Anaconda Prompt, do the following:
conda create -n myenv python=3.9 -y
conda activate myenv
Continue with the remaining installation steps using the conda environment created above
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.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip3 install autogluon
Note
If you run into difficulties installing AutoGluon on Windows, please provide details in this GitHub Issue.
Note: ObjectDetector and any model that uses MXNet is not supported on Windows! GPU-based MXNet is not supported on Windows, and it is recommended to use Linux instead for these models.
To install AutoGluon on Windows, it is recommended to use Anaconda:
- Install Anaconda
If Anaconda is already installed but is an old version, follow this guide to update
Open Anaconda Prompt (anaconda3)
Inside Anaconda Prompt, do the following:
conda create -n myenv python=3.9 cudatoolkit=11.3 -y
conda activate myenv
Install the proper GPU PyTorch version by following the PyTorch Install Documentation (Recommended). Alternatively, use the following command:
pip3 install torch==1.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
Sanity check that your installation is valid and can detect your GPU via testing in Python:
import torch
print(torch.cuda.is_available()) # Should be True
print(torch.cuda.device_count()) # Should be > 0
Continue with the remaining installation steps using the conda environment created above
pip3 install -U pip
pip3 install -U setuptools wheel
pip3 install autogluon
Note
If you run into difficulties installing AutoGluon on Windows, please provide details in this GitHub Issue.
Note: ObjectDetector and any model that uses MXNet is not supported on Windows! GPU-based MXNet is not supported on Windows, and it is recommended to use Linux instead for these models.
To install AutoGluon on Windows, it is recommended to use Anaconda:
- Install Anaconda
If Anaconda is already installed but is an old version, follow this guide to update
Open Anaconda Prompt (anaconda3)
Inside Anaconda Prompt, do the following:
conda create -n myenv python=3.9 -y
conda activate myenv
Continue with the remaining installation steps using the conda environment created above
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.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
git clone https://github.com/awslabs/autogluon
cd autogluon && ./full_install.sh
Note
If you run into difficulties installing AutoGluon on Windows, please provide details in this GitHub Issue.
Note: ObjectDetector and any model that uses MXNet is not supported on Windows! GPU-based MXNet is not supported on Windows, and it is recommended to use Linux instead for these models.
To install AutoGluon on Windows, it is recommended to use Anaconda:
- Install Anaconda
If Anaconda is already installed but is an old version, follow this guide to update
Open Anaconda Prompt (anaconda3)
Inside Anaconda Prompt, do the following:
conda create -n myenv python=3.9 cudatoolkit=11.3 -y
conda activate myenv
Install the proper GPU PyTorch version by following the PyTorch Install Documentation (Recommended). Alternatively, use the following command:
pip3 install torch==1.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
Sanity check that your installation is valid and can detect your GPU via testing in Python:
import torch
print(torch.cuda.is_available()) # Should be True
print(torch.cuda.device_count()) # Should be > 0
Continue with the remaining installation steps using the conda environment created above
pip3 install -U pip
pip3 install -U setuptools wheel
git clone https://github.com/awslabs/autogluon
cd autogluon && ./full_install.sh
AutoGluon is modularized into sub-modules specialized for tabular, text, or image data. You can reduce the number of dependencies required by solely installing a specific sub-module via: python3 -m pip install <submodule>, where <submodule> may be one of the following options:
- autogluon.tabular - only functionality for tabular data (TabularPredictor)
The default installation of autogluon.tabular standalone is a skeleton installation.
Install via pip install autogluon.tabular[all] to get the same installation of tabular as via pip install autogluon
Available optional dependencies: lightgbm,catboost,xgboost,fastai. These are included in all.
Optional dependencies not included in all: vowpalwabbit.
To run autogluon.tabular with only the optional LightGBM and CatBoost models for example, you can do: pip install autogluon.tabular[lightgbm,catboost]
Experimental optional dependency: skex. This will speedup KNN models by 25x in training and inference on CPU. Use pip install autogluon.tabular[all,skex] to enable, or pip install “scikit-learn-intelex<2021.5” after a standard installation of AutoGluon.
autogluon.vision - only functionality for computer vision (ImagePredictor, ObjectDetector)
autogluon.text - only functionality for natural language processing (TextPredictor)
autogluon.core - only core functionality (Searcher/Scheduler) useful for hyperparameter tuning of arbitrary code/models.
autogluon.features - only functionality for feature generation / feature preprocessing pipelines (primarily related to Tabular data).
To install a submodule from source, follow the instructions for installing the entire package from source but replace the line cd autogluon && ./full_install.sh with cd autogluon && python3 -m pip install -e {SUBMODULE_NAME}/{OPTIONAL_DEPENDENCIES}
For example, to install autogluon.tabular[lightgbm,catboost] from source, the command would be: cd autogluon && python3 -m pip install -e tabular/[lightgbm,catboost]
Quick Start¶
Application | Illustration |
---|---|
Tabular Prediction: predict values in column of data table based on other columns' values |
|
Image Prediction: recognize the main object in an image |
|
Object Detection: detect multiple objects with their bounding boxes in an image |
|
Text Prediction: make predictions based on text content |
Tutorials¶
How to predict variables in tabular datasets.
How to classify images into various categories.
How to detect objects and their location in images.
How to solve NLP problems via supervised learning from raw text.
How to solve problems that contain Image, Text, and Tabular features at the same time.