AutoGluon-TimeSeries

1.5.0 · active · verified Sun Apr 12

AutoGluon-TimeSeries is a module within the AutoGluon automated machine learning library, specifically designed for robust and accurate time series forecasting. It enables users to train state-of-the-art forecasting models with minimal code, leveraging various algorithms and ensemble methods. The library is actively maintained with frequent major and minor releases, providing continuous improvements in performance and features. The current version is 1.5.0.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to prepare time series data using `TimeSeriesDataFrame`, initialize `TimeSeriesPredictor`, train a model with a specified preset, and generate forecasts for future time steps.

import pandas as pd
from autogluon.timeseries import TimeSeriesPredictor, TimeSeriesDataFrame

# Create dummy data for demonstration
data = {
    "item_id": ["A", "A", "A", "B", "B", "B"],
    "timestamp": pd.to_datetime(["2023-01-01", "2023-01-02", "2023-01-03",
                                "2023-01-01", "2023-01-02", "2023-01-03"]),
    "target": [10, 12, 15, 20, 22, 25],
}
df = pd.DataFrame(data)

# Convert to TimeSeriesDataFrame format
train_data = TimeSeriesDataFrame(df)

# Initialize and train the predictor
predictor = TimeSeriesPredictor(
    prediction_length=2, # Forecast 2 future time steps
    target="target",     # Column to forecast
    eval_metric="MASE"   # Evaluation metric
)
predictor.fit(train_data, presets="fast_training") # Use a fast preset for quick demo

# Make predictions
predictions = predictor.predict(train_data)
print(predictions.head())

view raw JSON →