# Metric for distance of sinewaves

I have time-series data consisting of the sum of 2 sinewaves and my goal is to predict their frequencies and their amplitudes.

I would like to know what are the best distance metrics/loss functions I can use.

You can see from the following plots that the mean-square-error (MSE) is not an appropriate metric. In blue the predicted reconstructed sinewave, in orange the target one. As the title of the subplots, you can find the value of the MSE. In the first figure, the reconstruction is kindly worse, however, the MSE tells a different story.

First:

Second:

Is there a metric that can better emphasize this?

$$y(t) = a_0 + a_1 \cos(2 \pi f_1 t) + b_1 \sin(2 \pi f_1 t) + a_2 \cos(2 \pi f_2 t) + b_2 \sin(2 \pi f_2 t)$$
with $$f_k$$ denoting the frequencies of the two harmonics, and $$a_k$$ and $$b_k$$ the Fourier coefficients (cosine and sine amplitudes at the corresponding frequency). I'd construct the target and the reconstructed vector, $$t$$ and $$r$$:
$$t = \left[ a_{0t}, f_{1t}, a_{1t}, b_{1t}, f_{2t}, a_{2t}, b_{2t} \right]$$ $$r = \left[ a_{0r}, f_{1r}, a_{1r}, b_{1r}, f_{2r}, a_{2r}, b_{2r} \right]$$