AutoGluon

1.5.0 · active · verified Sun Apr 12

AutoGluon is an open-source AutoML library developed by AWS AI, designed to automate machine learning tasks for tabular, image, text, and time series data. It enables users to train and deploy high-accuracy machine learning and deep learning models with minimal code, often lauded for its '3 lines of code' capability. The library is actively maintained with frequent updates and is currently at version 1.5.0, offering state-of-the-art predictive performance.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use AutoGluon's TabularPredictor to train a model on tabular data and make predictions. It showcases the common workflow for classification or regression tasks with minimal code.

import pandas as pd
from autogluon.tabular import TabularPredictor, TabularDataset

# Create dummy training data
train_data = pd.DataFrame({
    'feature1': [1, 2, 3, 4, 5],
    'feature2': ['A', 'B', 'A', 'C', 'B'],
    'target': [0, 1, 0, 1, 0]
})
# Save to a CSV for TabularDataset
train_data.to_csv('train.csv', index=False)

# Create dummy test data
test_data = pd.DataFrame({
    'feature1': [6, 7],
    'feature2': ['C', 'A']
})
test_data.to_csv('test.csv', index=False)

# Load data using AutoGluon's TabularDataset
train_dataset = TabularDataset('train.csv')
# For demonstration, label is 'target'
label = 'target'

# Initialize and train the TabularPredictor
predictor = TabularPredictor(label=label, path='AutoGluonModels').fit(train_dataset, presets='medium_quality')

# Make predictions on new data
test_dataset = TabularDataset('test.csv')
predictions = predictor.predict(test_dataset)

print("Predictions:\n", predictions)
# Clean up generated files (optional)
import shutil
shutil.rmtree('AutoGluonModels', ignore_errors=True)
import os
os.remove('train.csv')
os.remove('test.csv')

view raw JSON →