# Tag Info

Accepted

### Keras Sequential model returns loss 'nan'

To sum up the different solutions from both stackOverflow and github, which would depend of course on your particular situation: Check validity of inputs (no NaNs or sometimes 0s). i.e df.isnull()....

### Custom loss function with additional parameter in Keras

You can write a function that returns another function, as is done here on GitHub ...
Accepted

### Parameterization regression of rotation angle

The second way, predicting $x=cos(\alpha)$ and $y=sin(\alpha)$ is totally okay. Yes, the norm of the predicted $(x, y)$ vector is not guaranteed to be near $1$. But it is not likely to blow up, ...
Accepted

### Why is there a $2$ at the denominator of the mean squared error function?

This is just for mathematical convenience. When you differentiate $C(w,b)$, you will get an extra $2$. To eliminate that, $2$ is kept beforehand in denominator. You can also watch this video on SVM ...
Accepted

### What is the difference between SGD classifier and the Logisitc regression?

Welcome to SE:Data Science. SGD is a optimization method, while Logistic Regression (LR) is a machine learning algorithm/model. You can think of that a machine learning model defines a loss function, ...

### What is the advantage of using log softmax instead of softmax?

Log softmax is $$\log(\exp(x)/\sum(\exp(x))) =x - \log(\sum(\exp(x))).$$ Now $\log(\sum(\exp(x))) \approx \max(x)$, since the sum is dominated by the largest entry. We see that log softmax is nearly ...
Accepted

### Custom loss function with additional parameter in Keras

I think the best solution is: add the weights to the second column of y_true and then: ...

### What's the difference between Error, Risk and Loss?

Error In this context, error is the difference between the actual / true value ($\theta$) and the predicted / estimated value ($\hat\theta$) $$Error = \theta - \hat\theta$$ Loss Loss and Risk are ...
Accepted

### Validation loss

Validation loss is the same metric as training loss, but it is not used to update the weights. It is calculated in the same way - by running the network forward over inputs $\mathbf{x}_i$ and ...

### Validation loss is lower than the training loss

It is certainly correct in the sense that it is a legitimate neural network. The dropout layer introduces noise that is not injected during the test period. The goal is to combat overfitting so that ...
Accepted

### Why does putting a 1/2 in front of the squared error make the math easier?

A major reason for using MSE is to optimize the parameters of a regression model. From calculus, you know how to find the minimum of a function by taking the derivative. That puts a "2" out ...

### Why using a partial derivative for the loss function?

It’s a minimization problem. The typical calculus approach is to find where the derivative is zero and then argue for that to be a global minimum rather than a maximum, saddle point, or local minimum. ...

### L2 loss vs. mean squared loss

To be precise, L2 norm of the error vector is a root mean-squared error, up to a constant factor. Hence the squared L2-norm notation $\|e\|^2_2$, commonly found in loss functions. However, $L_p$-...
They are different: L2 = $\sqrt{\sum_{i=1}^{N}(y_i-y_{i}^{pred})^2}$ MSE = $\frac{\sum_{i=1}^{N}(y_i-y_{i}^{pred})^2}{N}$ There are sum and ...