-
Notifications
You must be signed in to change notification settings - Fork 448
Open
Labels
Description
Description
Hi there,
I am writing to introduce a loss function tailored for time-series forecasting proposed in FreDF. The source code is provided in https://github.com/Master-PLC/FreDF. Nevertheless, you can ignore the released repo and directly implement FreDF through two lines of code as follows.
# The canonical temporal loss
loss_tmp = ((outputs-batch_y)**2).mean()
# The proposed frequency loss
loss_feq = (torch.fft.rfft(outputs, dim=1) - torch.fft.rfft(batch_y, dim=1)).abs().mean()
# Note. The frequency loss can be used individually or fused with the temporal loss using finetuned relative weights. Both witness performance gains, see the ablation study in our paper.
The efficacy of the loss function has been investigated through extensive experiments in this study. I recognized that there is a losses
module in NeuralForecast so I guess it would be helpful to include this plain and effective method.
Use case
No response
wasf84