hugobowne / deep-learning-from-scratch-pytorch

Deep Learning from Scratch with PyTorch
MIT License
113 stars 52 forks source link

fix typo in activation functions #9

Open bradyrx opened 4 years ago

bradyrx commented 4 years ago

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 commented 4 years ago

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

hugobowne commented 4 years ago

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 commented 4 years ago

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

bradyrx commented 4 years ago

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 commented 4 years ago

@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 :)

hugobowne commented 4 years ago

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.

bradyrx commented 4 years ago

Done!