Questions tagged [loss-functions]

For questions related to the concept of loss (or cost) function in the context of machine learning.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

How to interpret softmax + MSE in classification question?

I'm working on a GNN project associated with molecule classification. The project is to classify if the atom in the molecule will initiate a certain reaction. For example, A molecule can be ...
0
votes
0answers
17 views

Training labels: integers or vectors?

I'm trying to implement Deep Q Learning using Tensorflow. The input is a vectorized representation of the state, and the output is a vector whose length is the number of possible actions. I've already ...
0
votes
1answer
60 views

Why is loss displayed as a parabola in mean squared error with gradient descent?

I'm looking at the loss function: mean squared error with gradient descent in machine learning. I'm building a single-neuron network (perceptron) that outputs a linear number. For example: Input * ...
1
vote
0answers
31 views

Could the inputs of the mean squared-error loss function be transformed to allow larger learning rates?

In the context of a neural network $\hat{y} = f_\theta(\mathbf{x})$ with parameters $\theta$ that is trained to perform regression such that the prediction $\hat{\mathbf{y}} = [\hat{y}_1,\hat{y}_2,...,...
0
votes
2answers
63 views

In variational autoencoders, why do people use MSE for the loss?

In VAEs, we try to maximize the ELBO $\mathbb(E_q log\ p(x|z) + D_{KL}(q(z|x), p(z))$), but I see that many implement the first term as MSE of the image and it's reconstruction. Is this mathematically ...
2
votes
1answer
51 views

Is it possible to use an internal layer's outputs in a loss function?

For a network of the form: Input(10) Dense(200) Dense(100+10) Dense(20) Output() Those +10 outputs are what I want to add to ...
0
votes
1answer
38 views

Is the policy gradient expression in Fundamentals of Deep Learning wrong?

I don't understand the policy gradient as explained in Chapter-9 (Deep Reinforcement Learning) of the book Fundamentals of deep learning. Here is the whole paragraph: Policy Learning via Policy ...
1
vote
1answer
82 views

Why does the implementation of REINFORCE algorithm minimize the gradient term but not the loss?

I read the book "Foundation of Deep Reinforcement Learning, Laura Graesser and Wah Loon Keng", and when I go through the REINFORCE algorithm, they show the objective function: $$ J\left(\...
1
vote
0answers
16 views

Is it normal getting noise values in the error history along training iteration?

I'm giving my first steps in really learning machine learning. As an exercise in my online course, it was asked for me to code the Cost function of some neural network that should resolve the ...
0
votes
0answers
14 views

Do dataset sizes matter in a Style GAN?

When working with classifiers, a class imbalance is a huge issue for our models. If we have too many images of class 1 and too few images from ...
1
vote
0answers
19 views

How to deal with losses on different scales in multi-task learning?

Say I'm training a model for multiple tasks by trying to minimize sum of losses $L_1 + L_2$ via gradient descent. If these losses are on a different scale, the one whose range is greater will dominate ...
0
votes
0answers
11 views

How to update all the weights in case only one data out of n signals is observable

If we have cost function as $$E_i = (D_i -Y_i)^T Q (D_i -Y_i)$$, where $$Q=\begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}$$( in case only one data signal can ...
0
votes
0answers
15 views

Gradient of CTC Loss?

I am having a hard time figuring out how the gradient of the CTC loss function looks like. Could anyone explain that to me?
0
votes
1answer
24 views

setting up last layer in tensoflow for class type of label [closed]

I am creating a NN in tensorflow keras. the inputs are all float and the output is a class. The output currently encoded as a float, but only has 4 values (0,1,2,3). My model is similar to this: ...
1
vote
0answers
48 views

BlackOut - ICLR 2016: need help understanding the cost function derivative

In the ICLR 2016 paper BlackOut: Speeding up Recurrent Neural Network Language Models with very Large Vocabularies, on page 3, for eq. 4: $$ J_{ml}^s(\theta) = log \ p_{\theta}(w_i | s) $$ They have ...
0
votes
1answer
51 views

What error should I use for RNN?

I'm relatively new to machine learning, and I don't know what error I should use for an RNN. I want to use a simple Elman RNN to predict the cases of Covid-19 there will be in a hospital for the next ...
2
votes
0answers
32 views

Single-value loss/training in a CNN with a tensor output

I am playing around with an idea of using using Q-learning with a DQN (Deep Q-Network), to determine the optimal position of a number of 'units' on a grid of allowed locations, according to some ...
3
votes
1answer
70 views

How to incorporate a symmetry constraint in the loss function to train a CNN?

I have a task of extremely sparse binary segmentation, i.e. the segmentation mask contains either 0 or 1, and there are ~95% zeros and only ~5% ones. I use the focal loss to address the sparseness (...
1
vote
0answers
19 views
1
vote
0answers
36 views

How to make SAC (Soft-Actor-Critic) learn a policy?

I cannot make SAC learn a task in a certain environment. The point is that it actually sometimes finds a very good policy, but it never learns the policy in the end. I am using the SAC implementation ...
1
vote
1answer
162 views

What is the difference between a fitness function and a reward function?

In reinforcement learning (RL), the reward function (RF), which can be denoted as $r(s)$, $r(s, a)$, $r(s, a, s')$, $r(s, s')$ depending on its specific definition, provides the learning signal, which ...
1
vote
1answer
43 views

In this implementation of pix2pix, why are the weights for the discriminator and generator losses set to 1 and 100 respectively?

I am working on a pix2pix GAN model that was inspired by the code in this Github repository. The original code is working and I have already customized most of the code for my needs. However, there is ...
0
votes
1answer
67 views

When calculating the cost in deep Q-learning, do we use both the input and target states?

I just finished Andrew Ngs's deep learning specialization, but RL was not covered, so I don't know the basics of RL. So, I have been having trouble understanding the cost function in deep Q-learning. ...
0
votes
0answers
17 views

Which loss function should I use to train DDGP with multiple q values, one for each of the output dimensions?

I'm trying to come up with a loss function for the case, in DDPG, where we have as many outputs from the critic as there are from the actor. So, there will be one Q value for each dimension in the ...
1
vote
2answers
119 views

If the training data are linearly separable, which of the following $L(w)$ has less optimum answer for $w$, when $y = w^Tx$?

I'm studying machine learning and I came into a challenging question. The answer is 2. But based on my ML notes, all of them are true. Where are the wrong points?
0
votes
1answer
471 views

How to understand 'losses' in Spacy's custom NER training engine?

From the tid-bits, I understand of neural networks (NN), the Loss function is the difference between predicted output and expected output of the NN. I am following this tutorial, the losses are ...
1
vote
1answer
53 views

Have I understood the loss function from the original U-Net paper correctly?

In the original U-Net paper, it is written The energy function is computed by a pixel-wise soft-max over the final feature map combined with the cross entropy loss function. ... $$ E=\sum_{\mathbf{x} ...
0
votes
0answers
25 views

Correct way to work with both categorical and continuous features together

I have a time series with both continuous and categorical features, and I want to do a prediction task. I will elaborate: The data is composed of 100Hz sampling of some voltages, kind of like an ecg ...
0
votes
1answer
74 views

Why is the derivative of the softmax layer shaped differently than the derivative of other neurons?

If the derivative is supposed to give the rate of change of a function at that point, then why is the derivative of the softmax layer (a vector) the Jacobian matrix, which has a different shape than ...
0
votes
1answer
38 views

Loss randomly changing, incorrect output (even for low loss) when trying to overfit on a single set of input and output

I am trying to make a neural network framework from scratch in C++ just for fun, and to test my backpropagation, I thought it would be an easy way to test the functionality if I give it one input - a ...
0
votes
0answers
30 views

What is the effect of too harsh regularization?

While training a CNN model, I used an l1_l2 regularization (i.e. I applied both $L_1$ and $L_2$ regularization) on the final layers. While training, I saw the ...
2
votes
1answer
44 views

Which NN would you choose to estimate a continuous function $f:\mathbb R^2 \rightarrow \mathbb R$?

Suppose we want to estimate a continuous function $f:\mathbb R^2 \rightarrow \mathbb R$ based on a sample using a NN (around 1000 examples). This function is not bounded. Which architecture would you ...
6
votes
1answer
130 views

How is the DQN loss derived from (or theoretically motivated by) the Bellman equation, and how is it related to the Q-learning update?

I'm doing a project on Reinforcement Learning. I programmed an agent that uses DDQN. There are a lot of tutorials on that, so the code implementation was not that hard. However, I have problems ...
3
votes
1answer
70 views

What is the cost function of a transformer?

The paper Attention Is All You Need describes the transformer architecture that has an encoder and a decoder. However, I wasn't clear on what the cost function to minimize is for such an architecture. ...
0
votes
0answers
24 views

Implementing Multiclass Dice Loss Function

I am doing multi class segmentation using UNet. My input to the model is HxWxC and my output is, ...
1
vote
0answers
17 views

What is the intuition behind equations 10, 11 and 12 of the paper “Noise2Noise: Learning Image Restoration without Clean Data”?

Can anyone help me understand these functions described in the paper Noise2Noise: Learning Image Restoration without Clean Data I have read the portion A.4 in the appendix but need a more detailed and ...
1
vote
1answer
59 views

Explanation of this L2 minimization equation

I am trying to understand the last two lines of this math notation. How Var and double summation of Cov came to the equation. The first two lines I understood something like $(a-b)^2 = a^2 -2ab +b^2$.
4
votes
1answer
295 views

How should we interpret this figure that relates the perceptron criterion and the hinge loss?

I am currently studying the textbook Neural Networks and Deep Learning by Charu C. Aggarwal. Chapter 1.2.1.2 Relationship with Support Vector Machines says the following: The perceptron criterion is ...
2
votes
1answer
88 views

Why doesn't the set $\{ -2, +2 \}$ in $E(X) = (y − \text{sign}\{\overline{W} \cdot \overline{X} \}) \in \{ −2, +2 \}$ include $0$?

I am currently studying the textbook Neural Networks and Deep Learning by Charu C. Aggarwal. Chapter 1.2.1.2 Relationship with Support Vector Machines says the following: The perceptron criterion is ...
2
votes
0answers
28 views

Loss function decays linearly in segmentation MRI fascia

I am working on a segmentation of MRI images of the thigh. I am trying to segment the fascia, there is a slight imbalance between the background and the mask. I have about 1400 images from 30 patients ...
1
vote
1answer
62 views

Explain the difference in graphical patterns between discriminator fake loss and generator loss in GAN

In GAN (generative adversarial networks), let us take "binary cross-entropy" as the loss function for discriminator $$(overall \; loss = -\sum log(D(x_i)) -\sum log(1-D(G(z_i))) $$ $$ where \...
0
votes
0answers
37 views

Understanding the MuZero loss function for a two-player game

This question is connected to a question that I asked some time ago. This is how I understood the training procedure takes place (please correct any conceptual mistakes here): Many complete games are ...
1
vote
0answers
28 views

What is a “center loss”?

I have seen that a center loss is beneficial in computer vision, especially in face recognition. I have tried to understand this concept from the following material A Discriminative Feature Learning ...
2
votes
1answer
201 views

What is the impact of scaling the KL divergence and reconstruction loss in the VAE objective function?

Variational autoencoders have two components in their loss function. The first component is the reconstruction loss, which for image data, is the pixel-wise difference between the input image and ...
-1
votes
1answer
37 views

Loss function definition

I have read what the loss function is but I am not sure if I have understood it. For each neuron in the output layer the loss function is equal most usually to the square of the difference value of ...
0
votes
0answers
18 views

How to afine the extremity values in regression prediction with Keras?

I made a stack of bidirectional LSTM layers following by Dense layers (with swish activation functions) in order to predict a continuous value between 0 and 2. I compiled the model with ...
1
vote
0answers
24 views

Could the data augmentation lead to the model learning features which corresponds to data augmented data and not to the real data?

I am trying to train a Unet network with Synthetic data to do binary segmentation due to the fact that is is not easy to collect real data. And there is something in the training process that I do not ...
0
votes
0answers
27 views

Wasserstein GAN with gradient penality - Loss values

I have trained a WAN with gradient penalty and the loss values ​​seem to me much higher than the examples I have seen on the net. The generator receives 2 images as input and must generate a ...
2
votes
1answer
43 views

Evaluate model multiple times in loss function? Is this reinforcement learning?

I am interested in models that exhibit behavior. My goal is a model that survives indefinitely on a two dimensional resource landscape. One dimension represents the location (0 to 1) and the second ...
0
votes
0answers
16 views

Loss function for better class separability in multi class classification

So I am trying to enforce better separability in my deep learning model and was wondering what I can use besides cross entropy loss to do that? Could maybe using logarithm with different basis in ...