loss-function Questions

4

Solved

I am pretty new to neural networks. I am training a network in tensorflow, but the number of positive examples is much much less than negative examples in my dataset (it is a medical dataset). So,...
Humphries asked 17/11, 2018 at 18:20

3

Solved

I want to create a L2 loss function that ignores values (=> pixels) where the label has the value 0. The tensor batch[1] contains the labels while output is a tensor for the net output, both have a...

3

Solved

If I have something like: model = Model(inputs = input, outputs = [y1,y2]) l1 = 0.5 l2 = 0.3 model.compile(loss = [loss1,loss2], loss_weights = [l1,l2], ...) what does Keras do with the losse...
Ricard asked 21/3, 2018 at 10:48

3

I am using custom loss function(triplet loss) with mini-batch, during epoch the loss is gradually decreasing but just after the every epoch there is sudden drop in loss(appx. 10% of fall) and then ...
Dorree asked 29/7, 2019 at 7:9

28

Solved

I have a data matrix in "one-hot encoding" (all ones and zeros) with 260,000 rows and 35 columns. I am using Keras to train a simple neural network to predict a continuous variable. The code to mak...
Kinsley asked 14/5, 2016 at 23:4

2

Context I am trying to use a custom loss function for an XGBoost binary classifier. The idea was to implement in XGBoost the soft-Fbeta loss, which I read about here. Simply put: instead of using t...
Lard asked 15/6, 2023 at 11:22

3

Solved

I've read this blog by Keras on VAE implementation, where VAE loss is defined this way: def vae_loss(x, x_decoded_mean): xent_loss = objectives.binary_crossentropy(x, x_decoded_mean) kl_loss = -...
Hennebery asked 20/2, 2020 at 19:49

12

Solved

I try to pass 2 loss functions to a model as Keras allows that. loss: String (name of objective function) or objective function or Loss instance. See losses. If the model has multiple outputs, you...
Ontina asked 21/10, 2019 at 3:48

8

Solved

How do I add L1/L2 regularization in PyTorch without manually computing it?
Brochure asked 9/3, 2017 at 19:54

5

Solved

I have only one output for my model, but I would like to combine two different loss functions: def get_model(): # create the model here model = Model(inputs=image, outputs=output) alpha = 0.2 ...
Clergy asked 6/8, 2018 at 10:23

6

Solved

I'm learning keras API in tensorflow(2.3). In this guide on tensorflow website, I found an example of custom loss funciton: def custom_mean_squared_error(y_true, y_pred): return tf.math.reduce_me...

4

Solved

When not using KL divergence term, the VAE reconstructs mnist images almost perfectly but fails to generate new ones properly when provided with random noise. When using KL divergence term, the VA...

1

I have a regression neural network with ten input features and three outputs. But all ten features do not have the same importance in loss function calculation (mean square error). So I want to def...
Ulphiah asked 14/11, 2022 at 0:36

4

Solved

I am trying to implement a sequence-to-sequence task using LSTM by Keras with the TensorFlow backend. The inputs are English sentences with variable lengths. To construct a dataset with 2-D shape [...
Ftlb asked 1/11, 2017 at 14:37

2

Solved

Both the RMSE and the MAE are ways to measure the distance between two vectors: the vector of predictions and the vector of target values. Various distance measures, or norms, are possible. General...

3

Solved

I want to train a recurrent neural network using Tensorflow. My model outputs a 1 by 100 vector for each training sample. Assume that y = [y_1, y_2, ..., y_100] is my output for training sample x a...
Porphyria asked 7/5, 2021 at 15:21

5

I am training a PyTorch model to perform binary classification. My minority class makes up about 10% of the data, so I want to use a weighted loss function. The docs for BCELoss and CrossEntropyLos...
Waters asked 27/5, 2021 at 21:42

3

Solved

Based on the Tensorflow Documentation, one can add label smoothing to categorical_crossentropy by adding label_smoothing argument. My question is what about sparse categorical crossentropy loss. Th...
Sciuroid asked 15/3, 2020 at 2:27

1

Im trying to implement this zero-inflated log normal loss function based on this paper in lightGBM (https://arxiv.org/pdf/1912.07753.pdf) (page 5). But, admittedly, I just don’t know how. I don’t u...
Desiccant asked 25/5, 2022 at 17:6

1

I have this code: actual_loes_score_g = actual_loes_score_t.to(self.device, non_blocking=True) predicted_loes_score_g = self.model(input_g) loss_func = nn.L1Loss() loss_g = loss_func( predicted_...
Basilbasilar asked 29/4, 2022 at 17:50

3

Solved

I built a custom architecture with keras (a convnet). The network has 4 heads, each outputting a tensor of different size. I am trying to write a custom loss function as a function of this 4 output...
Pout asked 3/8, 2018 at 22:31

2

Solved

Setting As already mentioned in the title, I got a problem with my custom loss function, when trying to load the saved model. My loss looks as follows: def weighted_cross_entropy(weights): weig...
Leund asked 18/3, 2019 at 13:45

1

Solved

I am training a neural network to distinguish between three classes. Naturally, I went for PyTorch's CrossEntropyLoss. During experimentation, I realized that the loss was significantly highe...
Landmass asked 30/12, 2021 at 14:30

1

Focal Loss given in Tensorflow is used for class imbalance. For Binary class classification, there are a lots of codes available but for Multiclass classification, a very little help is there. I ra...
Clintonclintonia asked 23/12, 2021 at 9:12

3

Solved

I'm new with neural networks. I wanted to make a custom loss function in TensorFlow, but I need to get a vector of weights, so I did it in this way: def my_loss(weights): def custom_loss(y, y_pre...
Page asked 15/6, 2020 at 16:48

© 2022 - 2024 — McMap. All rights reserved.