Hi,
one test keeps failing for my implementation of backprop with dropout, but I believe my code to be correct and cannot seem to find what’s wrong with it. Can somebody help?
{code removed by mentor}
Hello @Giacomo_May,
Please post the full error traceback but not your code. I will remove the code for you.
Cheers,
Raymond
Hello @Giacomo_May,
Thank you.
From the first line in your latest screenshot, it does not produce the correct A3
, so there should be a bug in your code. I suggest you to add some print lines to your code to see where it starts to go wrong. Here is an example of how I would add them:
#(≈ 4 lines of code) # Steps 1-4 below correspond to the Steps 1-4 described above.
# D1 = # Step 1: initialize matrix D1 = np.random.rand(..., ...)
print('001', D1)
# D1 = # Step 2: convert entries of D1 to 0 or 1 (using keep_prob as the threshold)
print('002', D1)
# A1 = # Step 3: shut down some neurons of A1
print('003', A1)
# A1 = # Step 4: scale the value of neurons that haven't been shut down
print('004', A1)
For you to check your printed values, here is mine:
For example, if you find that your values for 001
are not the same as mine, then something was wrong in Step 1. After you get D1 and A1 correct, you probably want to make sure D2 and A2 are computed in the same way as your correct D1 and A1.
Good luck!
Cheers,
Raymond
Please compare the instructions in the comments with the random function you are using. How is a normal distribution going to help in this case?
True, I was using the wrong function. Thanks a lot!