Automating Time Series Forecasting with Auto-TS: An Expert Guide
Time series forecasting is a critical task in many domains, from retail demand planning to server capacity prediction. However, developing accurate and reliable forecasting models is often time-consuming and requires significant expertise. Automated Machine Learning (AutoML) offers a promising solution by leveraging intelligent algorithms to search for optimal models and hyperparameters. In this post, we‘ll take a deep dive into the Auto-TS library and its auto_ts Python API, and explore how it can streamline the end-to-end process of building time series models.
Time Series Fundamentals
Before we jump into automation, let‘s review some key concepts in time series analysis that will inform our modeling choices. A time series is a sequence of observations collected at regular intervals over time. Key characteristics of time series include:
- Trend: The overall long-term direction of the series (increasing, decreasing, or stable)
- Seasonality: Repeating patterns or cycles within the data (e.g., daily, weekly, or annual)
- Autocorrelation: The correlation of a series with lagged versions of itself
- Stationarity: Whether the statistical properties of the series (mean, variance) remain constant over time
To illustrate, let‘s look at an example using historical Amazon stock price data. Here‘s a plot of the daily closing price from 2006-2018:

We can see a clear upward trend and some potential seasonal patterns. To quantify the autocorrelation, we can create an autocorrelation function (ACF) plot:

The plot shows significant positive autocorrelation at multiple lags, suggesting that past values are predictive of future ones. This is a key insight for model selection, as we‘ll want to choose algorithms that can capture these temporal dependencies.
Auto-TS: An Overview
The Auto-TS library, developed by Shah (2022), aims to automate the key steps in the time series modeling pipeline, including:
- Data preprocessing (handling missing values, outliers, and stationarity)
- Feature engineering (creating lag variables and calendar features)
- Model selection (searching across a wide range of model classes and architectures)
- Hyperparameter tuning (optimizing model settings for performance)
- Ensemble generation (combining predictions from multiple models)
At the core of Auto-TS is a genetic algorithm (GA) that efficiently navigates the search space of models and hyperparameters. GAs are a type of optimization algorithm inspired by natural selection (Gupta & Ong, 2019). They maintain a population of candidate solutions, evaluate their fitness (e.g., cross-validation score), and evolve them over generations using selection, crossover, and mutation operators.
Auto-TS uses the TPOT library (Olson & Moore, 2019) as its GA implementation. TPOT represents ML pipelines as expression trees that it evolves to maximize a user-defined metric. For time series, Auto-TS defines a search space spanning multiple model classes:
- Statistical: ARIMA, SARIMA, VAR
- Machine Learning: Linear Regression, Random Forest, XGBoost
- Deep Learning: LSTM, GRU, Temporal Convolutional Networks (TCN)
Here‘s a simplified view of the Auto-TS architecture:

To use Auto-TS, users supply historical time series data, a forecast horizon, and a performance metric (e.g., mean squared error). Auto-TS then automatically searches for the best model pipeline and returns forecasts and performance estimates. The auto_ts Python package provides a scikit-learn-like API for easy interaction.
Benchmarking Auto-TS
To assess the performance of Auto-TS relative to other AutoML tools, we can refer to comparative studies like Jiang et al. (2022). They evaluated 5 open-source AutoML libraries on 10 benchmark time series datasets spanning different domains and forecast horizons. The results showed that Auto-TS achieved the best average rank in terms of mean absolute scaled error (MASE), outperforming Prophet, pmdarima, and GluonTS:
| Library | Average MASE Rank |
|---|---|
| Auto-TS | 1.7 |
| Prophet | 2.6 |
| pmdarima | 2.9 |
| GluonTS | 3.2 |
While these results are promising, it‘s important to note that no single tool will be best for every problem. The relative performance of different AutoML approaches can vary based on the characteristics of the data and the specific forecasting task.
A Deeper Dive into auto_ts
Let‘s explore the Auto-TS Python API in more detail, using our Amazon stock price example. After splitting the data into train and test periods, we can create an auto_ts model with:
model = auto_timeseries(
score_type=‘rmse‘,
time_interval=‘D‘,
non_seasonal_pdq=None,
seasonality=True,
seasonal_period=30,
model_type=[‘best‘],
verbose=2,
forecast_period=180
)
Here, we‘re specifying that we want to minimize RMSE, that our data is daily frequency, and that we suspect a monthly seasonal cycle (30 days). We‘ll let Auto-TS search across all model types and generate forecasts for the next 180 days.
Fitting the model to our training data is straightforward:
model.fit(
traindata=train_data,
ts_column=‘Date‘,
target=‘Close‘
)
Under the hood, Auto-TS will now preprocess the data, generate features, and search for the best model using TPOT. We can visualize the generations of the genetic algorithm to see the search progress:

After the search is complete, we can inspect the final model pipeline:
print(model)
Model: SARIMAX; Best Parameters: {‘order‘: (3, 1, 3), ‘seasonal_order‘: (1, 0, 1, 30)}
Model: LSTM; Best Parameters: {‘time_steps‘: 60, ‘num_layers‘: 2, ‘num_units‘: 128, ‘dropout_rate‘: 0.2, ‘epochs‘: 100}
Ensembled Model Summary
-----------------------
Number of Models: 2
Model Types: SARIMAX, LSTM
We can see that Auto-TS chose to ensemble a SARIMA model and an LSTM, with optimized hyperparameters for each. This illustrates how Auto-TS can automatically discover complex model configurations that may be challenging to specify manually.
Generating forecasts on new data is as simple as:
forecasts = model.predict(testdata=180)
This returns a DataFrame with the point forecasts for the next 180 days. We can visualize the predictions against the actual values:

The plot shows that our automatically-selected model accurately captures the overall trend and some of the shorter-term fluctuations in the price series. For a fully-automated approach with default settings, this is a strong result.
Conclusion and Future Directions
In this post, we‘ve seen how the Auto-TS library and auto_ts Python package can greatly streamline the process of building high-quality time series forecasting models. By automating the key steps of preprocessing, model selection, and hyperparameter tuning, Auto-TS can save significant time and effort compared to manual approaches. We‘ve also discussed the fundamental concepts and best practices for effectively applying Auto-TS to real-world problems.
Looking ahead, there are many exciting directions for AutoML in time series:
- Incorporating additional state-of-the-art modeling approaches, such as transformers (Vaswani et al., 2017) and neural basis expansion analysis (NBA) (Oreshkin et al., 2020)
- Extending to multivariate forecasting problems, where the goal is to jointly predict multiple interrelated time series
- Improving scalability and resource efficiency to handle large-scale problems with millions of series or high-frequency data
- Enhancing interpretability through techniques like feature importance estimation and counterfactual explanations
- Integrating with cloud platforms and streaming architectures for real-time forecasting applications
Automated time series forecasting is a rapidly-evolving field with the potential to transform business decision making. By staying up to date with tools like Auto-TS and understanding their underlying techniques, data scientists and analysts can harness the power of AutoML to generate accurate, timely, and actionable forecasts. The future is bright for intelligent automation in time series analysis!
References
- Ahmed, N. K., & Eckert, C. (2020). "Automated Machine Learning for Time Series Forecasting: A Survey." ArXiv:2012.11169 [Cs]. http://arxiv.org/abs/2012.11169
- Gupta, K., & Ong, Y.-S. (2019). "Evolutionary Algorithms for Hyperparameter Optimization in Time Series Models." ArXiv:1909.13423 [Cs, Stat]. http://arxiv.org/abs/1909.13423
- Jiang, F., Salhi, A., & Gluhak, A. (2022). "AutoML Frameworks for Time Series Forecasting: A Comparative Study." ArXiv:2201.08468 [Cs]. http://arxiv.org/abs/2201.08468
- Olson, R. S., & Moore, J. H. (2019). "TPOT: A Tree-Based Pipeline Optimization Tool for Automating Machine Learning." ArXiv:1905.06808 [Cs]. http://arxiv.org/abs/1905.06808
- Oreshkin, B. N., Carpov, D., Chapados, N., & Bengio, Y. (2020). "N-BEATS: Neural Basis Expansion Analysis for Interpretable Time Series Forecasting." ArXiv:1905.10437 [Cs, Stat]. http://arxiv.org/abs/1905.10437
- Shah, N. (2022). "Auto-TS: An Automated Time Series Forecasting Library." GitHub Repository. https://github.com/AutoViML/Auto_TS
- Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Polosukhin, I. (2017). "Attention is All you Need." ArXiv:1706.03762 [Cs]. http://arxiv.org/abs/1706.03762