Closed fecet closed 2 years ago
[UPDATE] I find the origin paper mentioned that the stop gradient in denominator, but I dont see this trick in his code and that may result in relative bad performance. I will keep investigating it.
The linear space function should use an adapted horizon,
def linear_space(backcast_length, forecast_length, is_forecast=True):
# ls = K.arange(-float(backcast_length), float(forecast_length), 1) / forecast_length
# return ls[backcast_length:] if is_forecast else K.abs(K.reverse(ls[:backcast_length], axes=0))
horizon = forecast_length if is_forecast else backcast_length
return K.arange(0,horizon)/horizon
@fecet thank you very much!! Can you detail a bit more what you found? Is it just changing the linear_space
and it works?
And yes please post the full code it's very interesting!
@fecet thank you very much!! Can you detail a bit more what you found? Is it just changing the
linear_space
and it works?
Yes, in former code, the denominator is always forecast_length
, when backcast_lenghth
is large, like 7*forecast_length
the value in linear_space
will reach up to 7
, result in output explode in trend block since it will be multiplied by 7*p
several times. And smape_loss
's own property make it become 200
as y_pred
dominate.
Thanks for your interest, I will create a repository for my reimplement later. BTW, I found this behaviour by your keract tool!
@fecet Very happy to hear that!! Please post your results and code. Thank you for using keract. I'm happy it helps ;)
thank you so much I'm going to have a look shortly
I added a link to your repo in the README btw
I'm trying to reproduce the results for m4 dataset and have done most work, but there still exist some problems, with frequency and lookback increase, the model tend to output large value and smape loss stop at something like 199.02. As the input size is determined by
horizon
(forcast_length) andlookback
:I guess the problem result from large input_size, but I have no idea how to fix it. Here is my smape loss
and my model config
If someone interested I will post the full code here.