SARIMAX — ACO Search

Hugo Abreu
2 min readDec 23, 2020

--

Hello,

I want to share with you guys a very usefull implemantation of ACO Algorithm.

In Machine learning, more specifically SARIMAX is a time series model that uses Seasonal Information and Exogenous Variables to perform a forecast, diferent from ARIMA wich only uses old data from the series itself to predict the future. As I like to make my article very simple, and don’t like repetitions of informations, you can read more about SARIMAX models in here: https://www.statsmodels.org/dev/examples/notebooks/generated/statespace_sarimax_stata.html

In python there is some implementations of autoarima, in a package called pmdarima that perforces an autoarima, using the same algorithm as in R autorima.

Ok, thats good for arima, but for SARIMAX there’s no automation at this same level of popularity, at leat none that I know (if you know, please leave a comment). So, my intention is to use ACO (Ant Colony Optimization) to implement an autosarimax.

The code bellow is an ACO.py implementation. The algorithm consists of ants whose depose on the points of the graph some ferormone based in the fitness function evaluated for the X represent by the point on the graph.

I have an example of how to use the ACO optimization algorithm over an function, please take a look.

Knowing that the ACO can optimize a function looking over a discrete space, the challenge was to implement a SARIMAX_ACO_Search function to use the SARIMAX output from each graph possibiliy and update the informations.

Some functions called from the code above are token from my TimeSeriesUtils.py.

Finally I made an example on how to use the sarimax_aco_search to find the best sarimax model for some fake arrays.

--

--

Hugo Abreu
Hugo Abreu

Written by Hugo Abreu

I am a control engineer and AI specialist. Please, find more info about me in : https://hugoabreu1002.github.io/

No responses yet