Hi,
I am trying to solve the merge everything together assignemnt however i keep getting assertion error and cant figure out what to do differently - here is the error.
Please click my name and message your notebook as an attachment.
You can see that the prediction values are incorrect for the predictions on the test set. Note that they compute that first and it fails, so you don’t get a check on whether your answers are also wrong for the training set case. I added some print statements and here’s what I see for that test case:
type(X_train) <class 'numpy.ndarray'>
X_train.shape (4, 7)
X_test.shape (4, 3)
Y_test.shape (3,)
num_iterations 50 learning_rate 0.01
pred train [[1. 1. 0. 1. 0. 0. 1.]]
pred test [[1. 1. 0.]]
w [[ 0.08639757]
[-0.08231268]
[-0.11798927]
[ 0.12866053]]
b -0.039832360948163205
All tests passed!
Whether your training predictions are correct or not might be a clue as to whether the bug is in your predict function or in how you are calling predict from model.
Thank you, so my predictions for both test and train are wrong in the second position. Mine w and b are correct. So i assume the problem will be how im calling the predict from the model? im using this function: Y_prediction_test = predict(w, b, X_test)
@ivan_tanczos There is a bug in the predict
function. Please look inside for for loop. In the else scenario, your assignment should not be for Y_prediction[0, 1]
.
Thank you, that just solved it! havent thought of looking back at my previous function since the tests said that it was solved, so i assumed it is correct
One more question, I was just testing the algorithm by uploading my own images, no matter what image i upload it always says it is a cat, i dont think that should be the case?
Could you provide a zip of a few images used in testing?
The models we train here (even the more advanced ones in Week 4 of this course, using the same dataset) just do not “generalize” well. The dataset is extremely small for a problem this difficult. It’s actually kind of amazing that the results are as good as they are. It turns out that they are “cooked” to be this good. Here’s a thread which discusses that in more detail w.r.t. the full 4 layer implementation of a Neural Net that we use for this same “cat detection” problem in Week 4.