z009LL
July 28, 2021, 5:25pm
1
I cannot compute cost. I get:
AssertionError: Test does not match. Did you get the mean of your cost functions?
But is only a line of code and i checked that line as much as i can. I am getting the mean (tf.reduce_mean())
What could be going on? I am not expert at python.
i shoul mutuply by (-1/m)?
m is num examples in logits?
thanks.
nramon
July 28, 2021, 8:28pm
2
Fixed by @z009LL .
A few hints for others with the same problem:
reduce_mean , as its name suggests, already computes the mean.
y_pred
and y_true
should have shape (number of examples, num_classes)
.
Make sure you’re passing the right parameters to categorical_crossentropy .
[Update] There is no need to set label_smoothing
, which is a regularization parameter.
Good luck with the rest of the specialization
6 Likes
Maggie
November 14, 2021, 12:06am
3
Same error message here. I have tried to transpose the inputs to match with the format, applied softmax to logits, but I’m still not getting the correct number. I’m not seeing where else can the error come from. Anything I missed?
Thanks
nramon
November 26, 2021, 9:27am
4
Fixed by @Maggie too.
Do not try to call tf.keras.activations.softmax
explicitly. Instead, see if categorical_crossentropy has a parameter that can help you.
Good luck with the rest of the assignment
3 Likes
Definitivamente no encuentro solución para este problema con las pistas que da. Puede exponer otras?
The problem with my answer was that I used reshape to conduct tensor transpose.
1 Like