Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

# Tag Info

Accepted

• 8,509

### Custom loss function with additional parameter in Keras

You can write a function that returns another function, as is done here on GitHub ...
• 8,978
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, ...
• 1,471

### 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: Add regularization to add l1 or l2 penalties to the weights. Otherwise,...
• 271
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 ...
• 1,729

### 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, ...
• 2,119
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: ...
• 641

### 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 ...
• 8,978
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 ...
• 2,745

### 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 ...
• 281
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 ...
• 27.2k
Accepted

• 171

### loss/val_loss are decreasing but accuracies are the same in LSTM!

I think this is because your targets y are continuous instead of binary. Therefore, either ignore the accuracy report, or ...
• 8,509

### What makes binary cross entropy a better choice for binary classification than other loss functions?

As mentioned in the blog, cross entropy is used because it is equivalent to fitting the model using maximum likelihood estimation. This on the other hand can be interpreted as minimizing the ...
• 5,959
Accepted

### Does small batch size improve the model?

In general smaller or larger batch size doesn't guarantee better convergence. Batch size is more or less treated as a hyperparameter to tune keeping in the memory constraints you have. There is a ...
• 1,216
Accepted

### Keras categorical_crossentropy loss (and accuracy)

I am using keras with tensorflow backend. I checked and the categorical_crossentropy loss in keras is defined as you have defined. This is the part of code (not the whole function definition)- ...
• 1,729

### Why do cost functions use the square error?

In addition to the key points made by others, using squared error puts a greater emphasis on larger error (what happens to 1/2 when you square it vs 3/2?). Having an algorithm that moves the ...
• 51

Only top scored, non community-wiki answers of a minimum length are eligible