Exercise 8 - schedule_lr_decay

<ipython-input-48-1b8d727c069a> in <module>
     11 print("Updated learning rate after {} epochs: ".format(epoch_num_2), learning_rate_2)
     12 
---> 13 schedule_lr_decay_test(schedule_lr_decay)

~/work/release/W2A1/public_tests.py in schedule_lr_decay_test(target)
    287 
    288     assert np.isclose(output_1, expected_output_1),f"output: {output_1} expected: {expected_output_1}"
--> 289     assert np.isclose(output_2, expected_output_2),f"output: {output_2} expected: {expected_output_2}"
    290 
    291     learning_rate = 0.3

AssertionError: output: 0.45454545454545453 expected: 0.5

Please I don’t know what is wrong with my code, I am not getting the expected value

You filed this under MLS, but it’s really DLS Course 2. I moved it for you by using the little “edit pencil” on the title.

There aren’t really that many moving parts in this algorithm. Compare your code carefully to the math formula given in the instructions. Just looking at it, my guess is that the most likely area for problems is the “order of operations”. Check your parentheses carefully to make sure you’re getting the operations done in the way specified by the instructions.

Just for comparison, here’s the output I see from that test cell:

Original learning rate:  0.5
Updated learning rate after 10 epochs:  0.5
Updated learning rate after 100 epochs:  0.3846153846153846
All test passed

Note that those first 3 values are independent of the hidden test case that is failing for you. Do you get those values or something different?

Hi @paulinpaloalto , Apologies for posting in the wrong forum.

My output from the test cell seems different from this. Here is mine below -:

Original learning rate:  0.5
Updated learning rate after 10 epochs:  0.4854368932038835
Updated learning rate after 100 epochs:  0.3846153846153846

And here is the what I came up with, following the formula

{moderator edit - solution code removed}

Hi @paulinpaloalto Never mind, I have been able to figure that out. Thank you so much

It looks like you neglected the “floor” part of the computation. I’m glad to hear that you found the solution under your own power.