1
$\begingroup$

While building an auto-encoder that preserves distances, i accidentally used the euclidean norm as the loss for the difference between the x and z distances that im trying to minimize. (I hope you can see why i got confused).

But after replacing the euclidean norm with MSE, the model behaved slightly worse.

So i am wondering, can I use the euclidean distance metric as a general loss function?

$\endgroup$

1 Answer 1

0
$\begingroup$

you can use the Euclidean distance as a loss function, and it is valid for many applications. However, slight differences in performance between Euclidean distance and MSE are expected due to their mathematical properties and the effect on gradient-based optimization. If MSE worked better for your specific model, it might be due to these differences and the nature of your data and model architecture. It's often useful to experiment with both and choose the one that provides the best results for your particular scenario.

  1. Euclidean Distance:

    • The Euclidean distance between two points ( x ) and ( x_hat ) in an n-dimensional space.

    • This measures the straight-line distance between two points.

  2. Mean Squared Error (MSE):

    • This measures the average squared difference between the corresponding elements of ( x ) and ( x_hat ).
  • Both the Euclidean distance and MSE involve squaring the differences between corresponding elements.
  • The Euclidean distance is the square root of the sum of these squared differences, while MSE is the average of the squared differences.
  • For an auto-encoder where you're trying to minimize the reconstruction error, both metrics can be appropriate but might lead to slightly different results due to their mathematical differences.
  1. Scale and Sensitivity:

    • Euclidean distance is more sensitive to the scale of the differences because it doesn't average them out. A single large difference can significantly affect the Euclidean distance.
    • MSE averages the squared differences, which can make the optimization landscape smoother and less sensitive to outliers.
  2. Gradient Characteristics:

    • The gradients of the Euclidean distance loss function and the MSE loss function are different. The Euclidean distance introduces a square root which can impact the gradient descent process differently compared to MSE.
    • MSE has simpler gradients, which can sometimes lead to more stable training.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.