add FreDF loss combining time-domain MSE and frequency-domain MAE#1563
add FreDF loss combining time-domain MSE and frequency-domain MAE#1563DresdenGman wants to merge 3 commits into
Conversation
|
|
|
@DresdenGman thanks for the contribution! Could you add a few tests in |
|
Added three tests in |
marcopeix
left a comment
There was a problem hiding this comment.
@DresdenGman, see my comment. Seems like you're adding an entirely new test file, but you should modify the existing test file.
| assert len(check.quantiles) == 5 | ||
|
|
||
|
|
||
| def test_fredf_alpha0_equals_mse(): |
There was a problem hiding this comment.
The tests are good, but it seems like the entire file is new. That's not right. You should modify the existing file: https://github.com/Nixtla/neuralforecast/blob/main/tests/test_losses/test_pytorch.py
Following up on #1301 — implements the FreDF loss proposed by Lin et al. (2023).
FreDF combines time-domain MSE with frequency-domain MAE via torch.fft.rfft, weighted by a tunable alpha parameter (default 0.5). When alpha=0 it reduces to pure MSE; when alpha=1 it reduces to pure frequency-domain MAE.
Added FreDF to all in losses/pytorch.py, inheriting BasePointLoss to stay consistent with the existing loss API.
Closes #1301