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
1
vote
0answers
35 views

Which loss function to choose for imbalanced datasets?

For imbalanced datasets (either in the context of computer vision or NLP), from what I learned, it is good to use a weighted log loss. However, in competitions, the people who are in top positions are ...
2
votes
0answers
28 views

Enforcing sparsity constraints that make use of spatial contiguity

I have a deep learning network that outputs grayscale image reconstructions. In addition to good reconstruction performance (measured through mean squared error or some other measure like psnr), I ...
1
vote
1answer
19 views

Back propagation approach to logistic regression: why is cost diverging but accuracy increasing?

Background I have tried to fit a logistic regression model - written using a forward / back propagation approach (as part of Andrew Ng's deep learning course) - to a very non-linear data set (see ...
1
vote
0answers
19 views

What is the purpose of the DAMSM loss for the generators in AttnGAN?

I am confused about the training part in AttnGan. If you observe page 3. There are two types of losses for generator network: one involving the Deep Attentional Multimodal Similarity Model (DAMSM) ...
2
votes
1answer
25 views

Generation of 'new log probabilities' in continuous action space PPO

I have a conceptual question for you all that hopefully I can convey clearly. I am building an RL agent in Keras using continuous PPO to control a laser attached to a pan/tilt turret for target ...
0
votes
1answer
41 views

Is the error function known or unknown?

What is the error function? Is it the same as the cost function? Is the error function known or unknown? When I get the outcome of a neural net I compare it with the target value. The difference ...
2
votes
1answer
31 views

Why is the mean used to compute the expectation in the GAN loss?

From Goodfellow et al. (2014), we have the adversarial loss: $$ \min_G \, \max_D V (D, G) = \mathbb{E}_{x∼p_{data}(x)} \, [\log \, D(x)] \\ \quad\quad\quad\quad\quad\quad\quad + \, \mathbb{E}_{z∼p_z(...
0
votes
0answers
16 views

How to calculate the attention loss in the paper “Tell Me Where to Look: Guided Attention Inference Network”?

I have been reading the research paper Tell Me Where to Look: Guided Attention Inference Network. In this paper, they calculate the attention loss, but I didn't understand how to calculate it. Do we ...
1
vote
0answers
35 views

Why would the loss increase on a single fixed input?

I'm training a neural network on some input data. I know that loss increasing may be related to: overfitting, if the loss increases on test data (while still decreases on training data) oscillations ...
1
vote
1answer
43 views

How could logistic loss be used as loss function for an ANN?

Normally, in practice, people use those loss functions with minima, e.g. $L_1$ mean absolute loss, $L_2$ mean squared error, etc. All those come with a minimum to optimize to. However, there's ...
2
votes
1answer
90 views

Why L2 loss is more commonly used in Neural Networks than other loss functions?

Why L2 loss is more commonly used in Neural Networks than other loss functions? What is the reason to L2 being a default choice in Neural Networks?
0
votes
0answers
44 views

Non-trainable regularizer in loss function

I train a fully convoluted network for semantic segmentation. To each convolution blocks, I associate a module pruning feature maps to reduce the quantity of information generated by the network. From ...
1
vote
0answers
44 views

Classification or regression for deep Q learning

DQN implemented at https://github.com/PacktPublishing/PyTorch-1.x-Reinforcement-Learning-Cookbook/blob/master/Chapter07/chapter7/dqn.py uses the mean square error loss function for the neural network ...
1
vote
0answers
53 views

Loss Function In Units Of Bits?

Where can I find a machine learning library that implements loss functions measuring the Algorithmic Information Theoretic-friendly quantity "bits of ...
2
votes
1answer
41 views

Should illegal moves be excluded from loss calculation in DQN algorithm?

I'm implementing DQN algorithm to train my agent to play a turn-based game. The action space for the game is small, but not all moves are available at all the states. Therefore, when deciding on which ...
0
votes
0answers
34 views

Which loss function and evaluation metric should I use for a multiple output prediction problem?

I was running into a situation with a data set like this I have 4 events and and they might happen together in pairs. I want to use 3 features to predict the coupling between event. I am building a ...
0
votes
0answers
16 views

How to figure out loss weight for label-imbalanced regression problems?

In classification, suppose you have 1 image labeled as cancer and 99 labeled as not cancer, you can just divide the loss weight of "not cancer" by 99. Then you can train the model as this ...
0
votes
1answer
76 views

Why is it useful to track loss while model is being trained?

Why is it useful to track loss while the model is being trained? Options are: Loss is only useful as a final metric. It should not be evaluated while the model is being trained. Loss dictates how ...
1
vote
0answers
33 views

LSTM - MAPE Loss Function gives Better Results when Data is De-Scaled before Loss Calculation

I am building an LSTM for predicting a price chart. MAPE resulted in the best loss function compared to ...
1
vote
0answers
32 views

What are some good loss functions used to minimize extreme errors in regression and time series forecasting?

I'm working on a time series forecasting task, and, in some specific cases, I don't need perfect accuracy, but the network cannot by any means miss by a lot. So, in detriment of a smaller mean error, ...
1
vote
0answers
71 views

How can the target rely on untrained parameters?

I'm trying to understand DQN. I understand where the loss function comes from. I'm just unsure about why the target function works in practice. Given the loss function $$ L_i(\theta_i) = [(y_i - Q(s,a;...
2
votes
1answer
47 views

Is there a way of deriving a loss function given the neural network and training data?

There is some sort of art to using the right loss function. However, I was wondering if there is a way to derive the loss function if I gave you a neural network model (the weights) as well as the ...
1
vote
0answers
33 views

Incorporating domain knowledge into recurrent network

I am currently trying to solve a classification task with a recurrent artificial neural network (RNN). Situation There are up to 350 inputs (X) mapped on one categorical output (y)(13 differnt ...
1
vote
0answers
43 views

Simplifying Log Loss

I am reading through a paper (https://www.mitpressjournals.org/doi/pdf/10.1162/0891201053630273) where they describe logloss as a ranking function and can be simplified to the margin of the training ...
1
vote
0answers
31 views

what will be the best loss function for unet to predict the each pixel values?

I'm predicting the used 9 pictures to predict the last picture so (40,40,9) -> unet -> (40,40,1) but as you see the predict picture It's not just a mask(0or 1) its float so which loss function ...
0
votes
0answers
18 views

Why do code implementations average the loss over a batch instead of finding the expected sample of that batch (using sampling probabilities)

Usually, our training objective over a batch is written in terms of the expected value of a sample in that batch such as $objective = E_{x \sim data} * log(P(x))$ But in the code implementations, ...
1
vote
0answers
42 views

How MSE should be appliead with multi target deep network?

I'm having a problem understanding how the MSE should be used when working with a multidimensional target, e.g 3 dimensiones. (My outputs are continuois values, not categorical) Let us say I have a ...
1
vote
1answer
66 views

How does the DQN loss from td_targets against q_values make sense?

Why td_loss is calculated from (td_targets against q_values)? Why I am lost is because: <...
0
votes
0answers
45 views

Can neural networks handle redundant inputs?

I have a fully connected neural network with the following number of neurons in each layer [4, 20, 20, 20, ..., 1]. I am using TensorFlow and the 4 real-valued ...
4
votes
1answer
87 views

Loss function for choosing a subset of objects

I'm trying to train a neural net to choose a subset from some list of objects. The input is a list of objects $(a,b,c,d,e,f)$ and for each list of objects the label is a list composed of 0/1 - 1 for ...
3
votes
1answer
46 views

How to add weights to one specific input feature to ensure fair training in the network?

I am trying to create a multiclass product-rating network based on product reviews and other input features. Two of the other input features are "product category" and "gender". However, I want to ...
2
votes
0answers
30 views

Single label classification into hierarchical categories using a neural network

I am working on a classification problem into progressive classes. In other words, there is some hierarchy of categories in such a way, that A < B < C, e.g. low, medium, high, very high. What ...
2
votes
1answer
149 views

Why does TensorFlow docs discourage using softmax as activation for the last layer?

The beginner colab example for tensorflow states: Note: It is possible to bake this tf.nn.softmax in as the activation function for the last layer of the network....
2
votes
0answers
42 views

Is Mean Squared Error Loss function a good loss function for continuous variables $0 < x < 1$

Suppose I am utilising a neural network to predict the next state, $s'$ based on the current $(s, a)$ pairs. all my neural network inputs are between 0 and 1 and the loss function for this network ...
1
vote
1answer
48 views

What do these numbers represent in this picture of a surface?

The following image is a screenshot from a video tutorial that illustrates the concept of gradient descent algorithm with a 3D animation. Do the numbers on the top of the balls pointed out by the red ...
0
votes
0answers
32 views

How should I define the loss function when using DQN to estimate the probability density?

I'm doing a Deep Q-learning project. All of my rewards are positive and there are two terminal states. One of them has a zero reward and the other has a high positive reward. The rewards are ...
1
vote
1answer
32 views

How are the weights retained for filters for a particular class in a CNN?

I am new to CNN. What I have learned so far about the filters is that when we are giving a training example to our model, our model updates the weights by gradient descent to minimize the loss ...
2
votes
0answers
26 views

Is there any wrong in my focal loss derivation?

Assume $\mathbf{X} \in R^{N, C}$ is the input of the softmax $\mathbf{P} \in R^{N, C}$, where $N$ is number of examples and $C$ is number of classes: $$\mathbf{p}_i = \left[ \frac{e^{x_{ik}}}{\sum_{j=...
4
votes
0answers
22 views

How do weights changes handles during back-propagation when there are unknown labels

I have a question about how weights are updated during back-propagation for some of my samples that have unknown labels (please note, unknown, not missing). The reason they are unknown is because this ...
2
votes
0answers
46 views

Why does GAN loss converge to log(2) and not -log(2)?

In Goodfellow's paper, he says: Hence, by inspecting Eq. 4 at $D^*_G (\mathbf{x}) = \frac{1}{2}$, we find $C(G) = \log \frac{1}{2}+ \log \frac{1}{2} = − \log 4$. To see that this is the best ...
0
votes
1answer
32 views

Is A2C loss function taking smaller steps for larger mistakes?

A2C loss is usually defined as advantage * (-log(actor_predictions)) * target where target is a one-hot vector (with some ...
2
votes
0answers
66 views

Why is the loss associated with my neural network increasing?

I am currently learning neural networks. Using data from http://www.mariofrank.net/touchalytics/index.html, I am trying to predict "User ID" by training the neural network model shown below. However, ...
4
votes
2answers
96 views

How to calculate the advantage in policy gradient functions?

From my understanding of the REINFORCE policy gradient method, we gently nudge the probabilities of actions based on the advantages. More specifically, the positive advantages increase the ...
0
votes
1answer
57 views

How do you perform a gradient based adversarial attack on an SVM based model?

I have an SVM currently and want to perform a gradient based attack on it similar to FGSM discussed in Explaining And Harnessing Adversarial Examples. I am struggling to actually calculate the ...
1
vote
0answers
21 views

How to update edge features in a graph using a loss function?

Given a directed, edge attributed graph G, where the edge attribute is a probability value, and a particular node N (with binary features f1 and f2) in G, the algorithm that I want to implement is as ...
1
vote
0answers
26 views

Face recognition model loss not decreasing

I wrote a script to do train a Siamese Network style model for face recognition on LFW dataset but the training loss doesnt decrease at all. Probably there's a bug in my implementation. Could you ...
1
vote
0answers
38 views

How to reduce fluctuation of a neural network?

I've modeled an AlexNet neural network, with 50 epochs and a batch size of 64. I used a stochastic gradient descent optimizer with a learning rate of 0.01. I attached the train and validation loss and ...
2
votes
1answer
39 views

How should I penalize the model proportionally to the error?

I am making an MNIST classifier. I am using categorical cross-entropy as my loss function. I want to make it so that if the correct label is 3, then it will penalize the model less heavily if it ...
1
vote
0answers
23 views

Keras MLP returns always loss 0.0 [closed]

I'm implementing a multilayer perceptron with Keras to predict the correct words order in a sentence. I'm using train_on_batch()because I convert each sentence in a ...
2
votes
0answers
27 views

Tversky Loss paper implementation: Recall/Precision do not improve as stated

I have been trying to implement this paper and I am very much intrigued. I am working on a medical image problem where I have to segment very small specimens on Whole Slide Images (gigapixel ...