Okay, so, “Nakashima Prediction”… Sounds fancy, right? I stumbled upon this while diving deep into some time series forecasting stuff. I was looking for ways to improve the accuracy of my predictions, and this popped up. I’d never heard of it before, so naturally, I had to try it out.

Getting Started
First things first, I needed to understand what the heck it even was. After some digging, I figured it’s basically a method used in forecasting, particularly useful when you’ve got data that shows trends and seasonality – you know, like sales data that goes up around Christmas and dips in February.
The next step was to find some data. I grabbed a publicly available dataset of monthly sales figures for some product. I’m a hands-on kind of person, so learning by doing is my jam.
Implementation Time
I decided to use Python because, well, it’s awesome for data stuff. Plus, there are tons of libraries that make life easier. I fired up my Jupyter Notebook (my go-to for experimenting) and started coding.
I used these libraries:
- pandas: For handling the data in a nice table format.
- NumPy: Because you always need NumPy for number crunching.
- Matplotlib: I use to visualise data.
I pre-processed the data, and handled some missing value.
The Actual Prediction
Now for the Nakashima part. Honestly, the math behind it looked a bit intimidating at first. But I found some helpful code snippets online (thank you, Stack Overflow!) that I adapted for my specific dataset.
I implemented the algorithm step-by-step, printing out the intermediate results to make sure things were working as expected. I won’t bore you with all the nitty-gritty details, but it involved calculating moving averages, seasonal indices, and trend factors.
Results and Tweaking
Finally, I plotted my predictions against the actual sales figures. And… it wasn’t half bad! There were some areas where it could be improved, but it definitely captured the overall trend and seasonality.

Then started checking out the differences.
Of course, this was just a first attempt. I spent some time tweaking the parameters of the Nakashima model, playing around with the moving average windows and such, to see if I could get a better fit. It was a bit of trial and error, but that’s part of the fun, right?
And that’s my story.