madagra/energy-ts-analysis

MAPE Calculation may be Incorrect

AaronWard opened this issue · 2 comments

Hey, I found this repo from the Medium article - thanks for posting the code!

Just one thing, the calculation for MAPE is incorrect:

mape.append(np.abs((a - f)/f))

should be

mape.append(np.abs((a - f)/a))

if

y = [1]
yhat = [2]

The result for true - forecast / forecast will be 50%
The result for true - forecast / actual will be 100%

https://www.forecastpro.com/Trends/forecasting101August2011.html

I have seen other people using the forecasted values as the denominator, is there a reason for this?

Hi Aaron! I am glad you found the code interesting and, I hope, helpful.

Thanks for pointing out the issue on the MAPE calculation, you are correct. Indeed the value one is comparing to (the actual in this case) should always be at the denominator. I fixed it in the last commit.

Definitely was helpful, thanks so much for showing an example of future forecasting and not just ending at the testing stage!