For the first question, RMSE and Euclidean distance have no difference, not that i know of.
For the second question, you only need the common loss function for normal tasks.
MSE is a common loss function used in linear regression tasks as well as loss function similar in nature like the RMSE. For classification tasks, Cross Entropy Loss is preferred. For logistic regression, use Binary Cross Entropy loss. See this for details:
Cross-entropy loss, or log loss, measure the performance of a
classification model whose output is a probability value between 0 and
1. It is preferred for classification, while mean squared error (MSE) is one of the best choices for regression. This comes directly from
the statement of your problems itself. In classification you work with
a very particular set of possible output values thus MSE is badly
To better understand the phenomena it is good to follow and understand
the relations between
Logistic regression (binary cross-entropy)
Linear regression (MSE)
You will notice that both can be seen as a maximum likelihood
estimator (MLE), simply with different assumptions about the dependent
When you derive the cost function from the aspect of probability and
distribution, you can observe that MSE happens when you assume the
error follows Normal Distribution and cross-entropy when you assume
binomial distribution. It means that implicitly when you use MSE, you
are doing regression (estimation) and when you use CE, you are doing
For a custom loss function, there is examples like the triplet loss and cases where you need to optimize two loss at once, then you need a custom loss function. For the case of triplet loss, it is used in one-shot learning tasks like face recognition. There, face images are fed through a CNN to get embeddings about description of the face. In the training phase there is three images per batch. One anchor, one positive (which is the same person as anchor
) and one negative (different person from anchor). The loss function, triplet loss, maximizes the distance between the anchor embedding and the negative embedding. In reverse, it also minimize the distance between the anchor embedding and the positive embedding. The loss function is like this:
As you can see, there is two components here, and they are subtracted to maximize the second component and minimize the first. The alpha value is to make the loss positive as the gradient descent optimizes the loss to be as near to zero as possible.
The case of style transfer also introduces a custom loss function. Here is the loss function:
Style transfer basically alters the input image to be styled like the style image of the system.
The loss function consist of style loss and content loss. The content loss decreases the distance of the output image and the style loss decreases the distance of the output image and the style in an artistic sense. The second loss makes the output image imitate the style of the the style image.
In both scenario a custom loss function is used. In both cases, the custom loss function is used to optimize two losses together, either positively or negatively. A weight can also be introduced to weight the two losses as shown in the second case. However the second case introduce a custom loss function. That leads to the second use of custom loss function. They can be used for specific tasks and optimize a specific goal. The first use for custom loss function can be explored but the second requires careful engineering and research.
So in short, custom loss function are used for either combining two loss or a specific task.
Hope I can help you.