All Questions
58 questions
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....
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 ...
0
votes
1
answer
138
views
Cannot verify manually the calculations by tf.keras.losses.BinaryCrossentropy
https://www.tensorflow.org/api_docs/python/tf/keras/losses/BinaryCrossentropy
The example in tensorflow site.
y_true = [0, 1, 0, 0]
y_pred = [-18.6, 0.51, 2.94, -12.8]
bce = tf.keras.losses....
1
vote
1
answer
2k
views
Why is the Tensorflow and Pytorch CrossEntropy loss returns different values for same example
I have tried getting Tensorflow and Pytorch CrossEntropyLoss but it returns different values and I don't know why. Please find the below code and results. Thanks for your inputs and help.
import ...
0
votes
1
answer
282
views
Cross-entropy validation losses comes out as a straight line
I'm trying to calculate cross-entropy losses using the Iris dataset, but when I ran my model and fired up my plots, both my losses and validation losses remained a straight line at zero. I don't know ...
0
votes
1
answer
321
views
How to implement a modified cross entropy loss function?
I am currently working on a change detection project for my university course and I was stuck at writing a custom loss function.I know i have to use function closure to be able to use data from layers ...
0
votes
1
answer
537
views
Why is the binary cross entropy loss during training of tf model different than that calculated by sklearn?
I am building a neural collaborative filtering recommendation model using tensorflow, using binary cross entropy as the loss function. The labels to be predicted are, of course, binary.
Upon training ...
1
vote
1
answer
992
views
Configuring labels in TensorFlow BinaryCrossentropy loss function
I want to compute cross-entropy loss using tf.keras.losses.BinaryCrossentropy. The documentation has the following example, and specifies that true labels and predicted labels should have the shape [...
0
votes
1
answer
222
views
How can I minimize parameters of a Weibull Distribution using Kullback-Leibler method in Python?
I want to find the parameters of a Weibull distribution by minimizing the parameters using Kullbak-Leibler method. I found a code here which did the same thing. I replaced the Normal distributions in ...
1
vote
2
answers
2k
views
Why is computing the loss from logits more numerically stable?
In TensorFlow the documentation for SparseCategoricalCrossentropy states that using from_logits=True and therefore excluding the softmax operation in the last model layer is more numerically stable ...
2
votes
1
answer
394
views
Using categorical_crossentropy for a sequence of images
I have a model that accepts a sequence of images as an input (None, n_step, 128, 128) (instead of a single image) where n_step is a fixed number 10. And I am using categorical_crossentropy for ...
1
vote
1
answer
3k
views
Selecting validation metric for `categorical_crossentropy` in Keras
I am looking at these two questions and documentation:
Whats the output for Keras categorical_accuracy metrics?
Categorical crossentropy need to use categorical_accuracy or accuracy as the metrics in ...
0
votes
1
answer
2k
views
TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type int64 of argument 'x'
after this code i am getting the error in categoricalfocalloss i m not getting whereint64 error is coming
def categorical_focal_loss(gamma=2., alpha=.25):
def categorical_focal_loss_fixed(y_true, ...
0
votes
1
answer
45
views
Why don't I get the same result as with tensorflow's method when I write my own expression?
I'm learning logistic regression and I want to calculate what is the value of the cross entropy loss function during minimizing it via gradient descent, but when I use tensorflow's ...
4
votes
3
answers
4k
views
Weighted sparse categorical cross entropy
I am dealing with a semantic segmentation problem where the two classes in which I am interested (in addition to background) are quiet unbalanced in the image pixels. I am actually using sparse ...