deep-learning-from-scratch-pytorch icon indicating copy to clipboard operation
deep-learning-from-scratch-pytorch copied to clipboard

fix typo in activation functions

Open bradyrx opened this issue 5 years ago • 7 comments

Fixes a typo in the instructor notebook that didn't add intermediate relu transformed step.

Originally:

# Compute 1st layer, including activation function
y1 = x @ w1 + b1
z1 = relu(y1)
print(z1)

# second layer + activation
z2 = y1 @ w2 + b2
y = np.sign(z2)
print(y)

Fixed:

# Compute 1st layer, including activation function
y1 = x @ w1 + b1
z1 = relu(y1)
print(z1)

# second layer + activation
z2 = z1 @ w2 + b2
y = np.sign(z2)
print(y)

bradyrx avatar Jul 08 '20 16:07 bradyrx

Although being notebooks without a seed set, this adds a lot of unnecessary changes..

bradyrx avatar Jul 08 '20 16:07 bradyrx

thanks for the PR @bradyrx !

it looks as though the final image in the NB has also been deleted, for some reason?

Could you put it back in?

it's this one:

rasbt-backprop

hugobowne avatar Jul 09 '20 05:07 hugobowne

also feel free to set the seed in the NB if you'd like

hugobowne avatar Jul 09 '20 05:07 hugobowne

Yep, getting on that now. I really wish there was a built-in notebooks differ for github. There are some solutions, e.g. reviewnb, but nothing's perfect.

bradyrx avatar Jul 09 '20 14:07 bradyrx

@hugobowne, added back in the image and put np.random.seed(42) in any cells with random numbers. It might be overkill as opposed to just putting it in the header. But I side with explicit calls for things like that in every cell, particularly when you're deep in a tutorial and want to remind the users how to get the same number.

Also I just noticed there's a typo in my branch name to fix a typo :)

bradyrx avatar Jul 09 '20 14:07 bradyrx

thanks @bradyrx ; i'd prefer only a single np.random.seed() when first generating random numbers in the NB

it's unnecessarily repetitive code and there's no need for everybody to get the same output in any given tutorial.

it will also make the instructor notebook too different from the student one.

hugobowne avatar Jul 10 '20 03:07 hugobowne

Done!

bradyrx avatar Jul 10 '20 16:07 bradyrx