Error in executing test case for assignment: Practice Lab: Neural Networks for Handwritten Digit Recognition, Binary

When creating a post, please add:

  • Week # must be added in the tags option of the post.
  • Link to the classroom item you are referring to: [Practice Lab: Neural Networks for Binary Classification | Coursera]
  • Description (include relevant info but please do not post solution code or your entire notebook):when i execute the test case i am getting the below errors:
  • IndexError Traceback (most recent call last)
    in
    27
    28 # Display the label above the image
    —> 29 ax.set_title(f"{y[random_index,0]},{yhat}")
    30 ax.set_axis_off()
    31 fig.suptitle(“Label, yhat”, fontsize=16)

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

this is in exercise 1
IndexError Traceback (most recent call last)
in
5 else:
6 yhat = 0
----> 7 print( "yhat = ", yhat, " label= ", y[0,0])
8 prediction = my_sequential(X[500], W1_tmp, b1_tmp, W2_tmp, b2_tmp, W3_tmp, b3_tmp )
9 if prediction >= 0.5:

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

IndexError Traceback (most recent call last)
in
28
29 # Display the label above the image
—> 30 ax.set_title(f"{y[random_index,0]},{tf_yhat},{my_yhat}")
31 ax.set_axis_off()
32 fig.suptitle(“Label, yhat Tensorflow, yhat Numpy”, fontsize=16)

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

this is from exercise 2

ValueError Traceback (most recent call last)
in
14 # Select rows corresponding to the random indices and
15 # reshape the image
—> 16 X_random_reshaped = X[random_index].reshape((20, 20)).T
17
18 # Display the image

ValueError: cannot reshape array of size 784 into shape (20,20)

this is from exercise 3

These errors suggest that you may have modified the notebook in some way that caused a lot of problems.

Did you modify any of the cells that you were not intended to?

  • Do not add any cells
  • Do not move any cells
  • Do not delete any cells
  • Only add your code to the places that are clearly marked inside the graded functions.