C3 W1 assignment log perplexity

I am able to get the desired results but my code is failing to pass the unit test. Can someone please help me?

1 Like

Try the axis=-1 lets see if that fixes the issue!

2 Likes

Worked. Thank you so much

1 Like

For that particular unittest inputs shapes are preds=(2, 1, 7, 3) and target=(2, 7)
Is that ligit use case? Why/when it is possible?
I would expect preds to be (2, 7, 3) for target=(2, 7)
Am I missing something?
Thanks in advance.

Hi @Andrey_Kochergin

You’re right that is not the most common case and the more common case is the one you expect ((2, 7, 3) and (2, 7)).

I believe this unit test was intentionally contrived to check if the learner’s implementation gets preds on the last axis (the most common case -1) and not some arbitrary axis.

Cheers