C3W3 Assignment Exercise 4 Evaluation/classify - Confusion matrix is wrong (not exactly matches to the expected output)

For Exercise 4 classify function, I got wrong confusion matrix:

Accuracy 0.72470703125
Confusion matrix:
[[4872 1510]
[1309 2549]]

Compared with expect results.

Expected Result

Accuracy ~0.725
Confusion matrix:
[[4876 1506]
[1300 2558]]

Someone has such cases before and can help ?

LAB ID: xtitwhcjfewf

2 Likes

Hi!
That might be cause by a slight variance in trained weights of the model and is acceptable. To be more precise, you can recheck you previous exercises and make sure that you are using tf functions everywhere.
This variance should not impact your Ex5 grades. Let us know if it does.

hi, may i ask how did you had the accuracy and confusion matrix by vectorize? I used for loop and get accuracy of 0.748 and stuck in the confusion matrix part.

@jyadav202 , hello,

I’m getting the same accuracy and cm as above.
How was this solved for Jatin?
I suspect that the pre-trained model and the unittest might be out of sync.

Please, help.

@Yizhuo_Han were you able to solve it?
@FranciscoMoreno please share your code with me and describe your situation.

@jyadav202 , thanks for the prompt reply.

I run the full “Assignment 3: Question duplicates” lab and all tests pass with the exception of Exercise 04, in which I get

0 tests passed
8 tests failed

I have no syntax errors, my function classify yields accuracy and confusion matrix numbers that are very close to the expected results. For example:

There is a difference of 13 fewer correct predictions than expected, our of 10240 total predictions. That is odd, and doesn’t seem to point to an error in my function.

Note that the input to the function is a pre-trained model.

How do I give you access to my code in a secure and ethical manner?

Thanks.

1 Like

Hi,

C3W3, part 4 and part 5 are confusing with outdated comments and code. Moreover, test cases failed. Need help to move on.

If you have updated your lab code with the latest notebooks and you are still not able to get the correct confusion matrix, please send me a copy of your notebook to me privately. You can go to my profile and send me a private message.

The latest notebook has sufficient comments for a learner to pass the test cases. However, there is always room for improvement. Please elaborate on where you are stuck and which part is confusing.

Sent private messages in detail. Thanks.

It works for me now. Thaks a lot for the help!

To those coming here and still find the section confusing, please update your assignment as it was recently updated with better instructions. Go to “help → get latest version” to do that.

Note: To get a new copy of the notebook using “Help → Get latest version”, you first have to rename your existing notebook (using the File menu).

Please share the details of the function if possible. I am unable to create v1, v2 here.

Hi @Khushboo_Gupta

Please remove your solution code since it’s against the rules.

Also, very important, that you do not remove code comments like ### START CODE HERE ### and ### END CODE HERE ###, because they are important for grading.

As for your question, you could refer how to get v1 and v2 please check this post or this post

Cheers

1 Like