cross-entropy Questions

3

Solved

*My Training Model* def train(model,criterion,optimizer,iters): epoch = iters train_loss = [] validaion_loss = [] train_acc = [] validation_acc = [] states = ['Train','Valid'] for epoch in r...

3

I've got a 40k image dataset of images from four different countries. The images contain diverse subjects: outdoor scenes, city scenes, menus, etc. I wanted to use deep learning to geotag images. ...

3

Solved

I have the following expression: log = np.sum(np.nan_to_num(-y*np.log(a+ 1e-7)-(1-y)*np.log(1-a+ 1e-7))) it is giving me the following warning: RuntimeWarning: invalid value encountered in log l...
Faviolafavonian asked 28/5, 2016 at 7:14

4

Solved

For a very simple classification problem where I have a target vector [0,0,0,....0] and a prediction vector [0,0.1,0.2,....1] would cross-entropy loss converge better/faster or would MSE loss? When...

2

I was trying to understand how weight is in CrossEntropyLoss works by a practical example. So I first run as standard PyTorch code and then manually both. But the losses are not the same. from tor...
Interrelated asked 24/4, 2020 at 17:29

4

Solved

I am trying to solve a simple binary classification problem using LSTM. I am trying to figure out the correct loss function for the network. The issue is, when I use the binary cross-entropy as los...
Nee asked 6/5, 2019 at 23:44

3

Solved

Classification problems, such as logistic regression or multinomial logistic regression, optimize a cross-entropy loss. Normally, the cross-entropy layer follows the softmax layer, which produces p...

1

Solved

I understand that PyTorch's LogSoftmax function is basically just a more numerically stable way to compute Log(Softmax(x)). Softmax lets you convert the output from a Linear layer into a categorica...
Desegregate asked 8/12, 2020 at 3:0

2

When trying to get cross-entropy with sigmoid activation function, there is a difference between loss1 = -tf.reduce_sum(p*tf.log(q), 1) loss2 = tf.reduce_sum(tf.nn.sigmoid_cross_entropy_with_log...

4

I was wondering is there an equivalent PyTorch loss function for TensorFlow's softmax_cross_entropy_with_logits?
Poultry asked 14/9, 2017 at 12:0

3

Solved

I am having a hard time with calculating cross entropy in tensorflow. In particular, I am using the function: tf.nn.softmax_cross_entropy_with_logits() Using what is seemingly simple code, I can...
Pelops asked 1/3, 2017 at 0:58

3

Solved

I know that there are a lot of explanations of what cross-entropy is, but I'm still confused. Is it only a method to describe the loss function? Can we use gradient descent algorithm to find ...
Thread asked 1/2, 2017 at 21:38

1

Solved

In Tensorflow 2.0, there is a loss function called tf.keras.losses.sparse_categorical_crossentropy(labels, targets, from_logits = False) Can I ask you what are the differences between setting fr...
Pharmacognosy asked 21/3, 2019 at 23:26

3

Solved

After using TensorFlow for quite a while I have read some Keras tutorials and implemented some examples. I have found several tutorials for convolutional autoencoders that use keras.losses.binary_c...
Ablaze asked 18/12, 2017 at 22:3

1

Solved

I am trying to implement a Softmax Cross-Entropy loss in python. So, I was looking at the implementation of Softmax Cross-Entropy loss in the GitHub Tensorflow repository. I am trying to understand...
Upend asked 2/5, 2020 at 11:39

10

In the following TensorFlow function, we must feed the activation of artificial neurons in the final layer. That I understand. But I don't understand why it is called logits? Isn't that a mat...

1

Solved

By default, PyTorch's cross_entropy takes logits (the raw outputs from the model) as the input. I know that CrossEntropyLoss combines LogSoftmax (log(softmax(x))) and NLLLoss (negative log likeliho...
Fenestra asked 11/2, 2020 at 10:9

2

Solved

What are the differences between all these cross-entropy losses? Keras is talking about Binary cross-entropy Categorical cross-entropy Sparse categorical cross-entropy While TensorFlow has S...

2

Solved

I'm trying to understand this loss function in TensorFlow but I don't get it. It's SparseCategoricalCrossentropy. All other loss functions need outputs and labels of the same shape, this specific l...

4

I have a network that produces a 4D output tensor where the value at each position in spatial dimensions (~pixel) is to be interpreted as the class probabilities for that position. In other words, ...

2

I am trying to implement a classification problem with three classes: 'A','B' and 'C', where I would like to incorporate penalty for different type of misclassification in my model loss function (k...
Eterne asked 21/6, 2019 at 2:20

1

I'm new to Keras (and ML in general) and I'm trying to train a binary classifier. I'm using weighted binary cross entropy as a loss function but I am unsure how I can test if my implementation is c...
Workingman asked 19/6, 2018 at 9:35

1

The pytorch tutorial (https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html#sphx-glr-beginner-blitz-cifar10-tutorial-py) trains a convolutional neural network (CNN) on a CIFAR da...
Crook asked 6/3, 2019 at 18:49

2

Solved

I am learning the neural network and I want to write a function cross_entropy in python. Where it is defined as where N is the number of samples, k is the number of classes, log is the natural l...
Heuristic asked 19/11, 2017 at 13:8

1

I wrote a vanilla autoencoder using only Dense layer. Below is my code: iLayer = Input ((784,)) layer1 = Dense(128, activation='relu' ) (iLayer) layer2 = Dense(64, activation='relu') (layer1) l...

© 2022 - 2024 — McMap. All rights reserved.