Product Experimentation Forecasting with SARIMAX in Python

Max Bade
2 min readDec 2, 2022

Intro

Let’s call it what it is — a line. We’re going to forecast a line.

Code Explanation

I am not the person to give in-depth context to the model used in this script. I am 100% just a user of the model and the library. But face it, you came here hoping to get some code… plug in a dataframe… and all your problems will be solved.

Listen, this isn’t going to solve all your problems, (Obviously that line was coming next), but it will probably make this little task you’re working go by quicker.

This person did a nice job going in to detail though on this model:

Code

Just plug in your dataset, make sure it has the following columns:

  • the date (each day experiment is running)
  • the experiment name
  • the variant name
  • the metric for which you’re forecasting
  • and the value of the metric

Results

Ok clearly this wasn’t the best experiment. Let me try another.

Well, I’m not a product person. Perhaps you should limit the dates… the script grabs all available dates, but you’re free to limit the df by date before you run the function. There’s also a cool step param that forecasts the number of days/time/steps — whatever level your data is on (rows — is it a day per row, an hour per row etc.).

Anyways, enjoy (:)

-Max

--

--

Max Bade

Data Science and Analytics Consultant. Email: Maxbade@yahoo.com. linkedIn:www.linkedin.com/in/maxbade github:https://github.com/maxwellbade