Course 1: Week 3 assignment: accuracy does not change (5*%)

Hello, I am facing an issue with the accuracy. I am getting an accuracy of only 58% after executing 5.2. The values of cost after iterations are the same for nn_model() and model test on planar data set. I am not understanding. Please can anyone help me with this?

I’m facing the same issue. I have cleared all the tests but the accuracy is 58%.

The grader output is 88/100
[ValidateApp | INFO] Validating ‘/home/jovyan/work/submitted/courseraLearner/W3A1/Planar_data_classification_with_one_hidden_layer.ipynb’
[ValidateApp | INFO] Executing notebook with kernel: python3
Tests failed on 1 cell(s)! These tests could be hidden. Please check your submission.

@Nikitha, You must be making some mistake in your nn_model function that has the general flavor of hard-coding things so that you still pass the test in the notebook for nn_model. The cost values you show do not agree with mine. Here’s what I get for the “real” training:

Cost after iteration 0: 0.693048
Cost after iteration 1000: 0.288083
Cost after iteration 2000: 0.254385
Cost after iteration 3000: 0.233864
Cost after iteration 4000: 0.226792
Cost after iteration 5000: 0.222644
Cost after iteration 6000: 0.219731
Cost after iteration 7000: 0.217504
Cost after iteration 8000: 0.219430
Cost after iteration 9000: 0.218551

Notice that your cost values are exactly the same as those in the test case, as opposed to the real training. So have a careful look to see why you are duplicating those results instead of getting the new ones I showed. For example, I can get those costs and 58% test accuracy by changing the real training cell to reference t_X and t_Y instead of the real data X and Y. Or by changing the internal code in nn_model to reference the global variables t_X and t_Y instead of the parameters.

Hi Paul

I haven’t used any test values in the code. The code consists X and Y variables.

Ok, that’s just one suggestion. So study the code carefully: how else could it happen that your cost values end up being the same with the “real” data that they were with the “test” data?

I figured it out ! Thanks Paul :slight_smile:
I used W and b of test values and values didn’t get updated when I ran real values.

Thank You, I did the same mistake as you mentioned, I used t_x and t_y reference training cell instead of X and Y.