Skip to main content

All Questions

Tagged with
0 votes
1 answer
201 views

Cross-entropy loss with varying number of classes

Is there a standard/efficient way in Pytorch to handle cross-entropy loss for a classification problem where the number of classes depends on the sample? Example: In a batch of size 3, I have: logits1 ...
SuperTardigrade's user avatar
0 votes
1 answer
76 views

Analytical gradient of Softmax entropy loss does not match the numerical gradient

I'm trying to implement the gradient of the softmax entropy loss in Python. However, I can see that the analytical gradient does not match the numeric gradient. Here is my Python code: import numpy as ...
Jawad Damir's user avatar
0 votes
1 answer
173 views

Why does my CNN for a Binary Classification problem have a constant 50% accuracy with BCELoss vs 80%+ with Cross Entropy Loss?

I am creating a CNN from scratch with Pytorch. I have a balanced dataset of images, split in half for both classes. I am trying to use the BCEwithLogitsLoss function from torch.nn as I have read that ...
JNuevo's user avatar
  • 1
0 votes
1 answer
59 views

What causes this model to not improve?

I'm very new to pytorch and have a system that I believe can unpack and run through data, but when it does so the accuracy it returns with, even after hundreds of epochs, is still worse than random ...
spookysynth's user avatar
3 votes
1 answer
269 views

Pytorch CrossEntropy Loss, getting error: "RuntimeError: Boolean value of Tensor with more than one value is ambiguous"

I have a classification model, producing predictions for 4 classes in a tensor of shape (256, 1, 4)...256 is the batch size, while the "1" for the second dimension is due to some model ...
Carlo's user avatar
  • 1,590
0 votes
1 answer
35 views

Tensorflow binary classifier with weighted loss function - Why does train history accuracy doesn't match train accuracy?

I'm trainig a NN with the following code: model = tf.keras.Sequential([ tf.keras.layers.InputLayer(input_shape=(input_length,)), tf.keras.layers.Dropout(0.8, seed=42), tf.keras.layers....
mat.tho's user avatar
  • 204
0 votes
0 answers
67 views

KL divergence corrected for limited sample size bias

I have a reference distribution R from which I am sampling to create distributions of different sample sizes. These new distributions are of same dimensions but with different numbers of data points. ...
ridul's user avatar
  • 1
0 votes
1 answer
102 views

why does my neural network coded from scratch results have such a weird loss trend?

I am developing neural network from scratch. It consists of of the following input > layer1(sigmoid) > layer2 > output(softmax). The basic coding is complete but when I ran it, I obtain a ...
gingerorange's user avatar
0 votes
0 answers
1k views

PyTorch RuntimeError: Expected floating point type for target with class probabilities, got Long

I am trying to calculate the validation loss for my object detection model using Pytorch. My pre-trained model is faster rcnn. Below is the function I used to calculate the validation loss import ...
user21705974's user avatar
1 vote
1 answer
89 views

Where are the actual predictions stored for Tensorflow keras CategoricalCrossentrophy model?

I'm learning about python and machine learning and reproduced some published code in a Kaggle notebook and modified it for my data within Azure Data Studio running Python 3. (Removed externally ...
joshAU's user avatar
  • 39
0 votes
1 answer
73 views

CrossEntropyLoss using weights gives RuntimeError: expected scalar type Float but found Long neural network

I am using a Feedforward neural network for a classification task with 4 classes. The classes are imbalanced and hence, I want to use a weight with the CrossEntropyLoss as mentioned here. Here is my ...
diviquery's user avatar
  • 759
0 votes
0 answers
402 views

Getting Error: TypeError: cross_entropy_loss(): argument 'target' (position 2) must be Tensor, not tuple

I am working on a CNN multi-class classification of different concentrations (10uM, 30uM, etc.) I create my dataset to include the images as the features and the concentrations as labels. Note that ...
Zelreedy's user avatar
0 votes
1 answer
172 views

Getting wrong output while calculating Cross entropy loss using pytorch

Getting wrong output while calculating Cross entropy loss using pytorch Hi guys , I calculated the cross entropy loss using pytorch , Input = torch.tensor([[1.,0.0,0.0],[1.,0.0,0.0]]) ,label = torch....
Sukesh Ram's user avatar
1 vote
0 answers
1k views

RuntimeError: cuDNN error: CUDNN_STATUS_MAPPING_ERROR

Why is there no way to calculate the loss value? (About CrossEntropyLoss) My code is a binary classification problem. I try to calculate the loss value in the final test stage, and finally use the ...
蘇煥淇's user avatar
1 vote
1 answer
80 views

analyze the train-validation accuracy learning curve

I am building a two-layer neural network from scratch on the Fashion MNIST dataset. In between, using the RELU as activation and on the last layer, I am using softmax cross entropy. I am getting the ...
Akshat's user avatar
  • 121

15 30 50 per page
1
2 3 4 5
11