Hi,
I’m on the programming assignment in week 3, specifically at 5.2 - Test the Model on the Planar Dataset
Everything so far works and I have passed all the tests.
However when I run the cell(no solution here, we just have to run the cell)
Build a model with a n_h-dimensional hidden layer
parameters = nn_model(X, Y, n_h = 4, num_iterations = 10000, print_cost=True)
Plot the decision boundary
plot_decision_boundary(lambda x: predict(parameters, x.T), X, Y)
plt.title("Decision Boundary for hidden layer size " + str(4))
I get this output with the error. It looks like a error coming out of the grader, and not through student code:
Cost after iteration 0: 0.693162
Cost after iteration 1000: 0.258625
Cost after iteration 2000: 0.239334
Cost after iteration 3000: 0.230802
Cost after iteration 4000: 0.225528
Cost after iteration 5000: 0.221845
Cost after iteration 6000: 0.219094
Cost after iteration 7000: 0.220661
Cost after iteration 8000: 0.219409
Cost after iteration 9000: 0.218485
AttributeError Traceback (most recent call last)
in
3
4 # Plot the decision boundary
----> 5 plot_decision_boundary(lambda x: predict(parameters, x.T), X, Y)
6 plt.title("Decision Boundary for hidden layer size " + str(4))
~/work/release/W3A1/planar_utils.py in plot_decision_boundary(model, X, y)
14 # Predict the function value for the whole grid
15 Z = model(np.c_[xx.ravel(), yy.ravel()])
—> 16 Z = Z.reshape(xx.shape)
17 # Plot the contour and training examples
18 plt.contourf(xx, yy, Z, cmap=plt.cm.Spectral)
AttributeError: ‘list’ object has no attribute ‘reshape’
Let me know if anyone else faced a similar problem, or any fixed, or if I’m going wrong somewhere
Thanks!