Created
June 29, 2019 00:22
-
-
Save acharles7/309139ec2910a58045e1b6be91d46d6d to your computer and use it in GitHub Desktop.
Simple two layer NN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
w1 = 0.01 * np.random.randn(1, 3) | |
b1 = np.zeros((1,3)) | |
w2 = 0.01 * np.random.randn(1, 4) | |
b2 = np.zeros((1,4)) | |
w3 = 0.01 * np.random.randn(1, 1) | |
f = lambda x: 1/(1 + np.exp(-1)) #Sigmoid Function | |
x = np.random.randn(3,1) #3 X 1 | |
h1 = f(np.dot(w1, x) + b1) #4 X 1 | |
h2= f(np.dot(w2, h1) + b2) #4 X 1 | |
out = np.dot(w3, h2) #1 X 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment