Created
November 23, 2017 14:10
-
-
Save RANUX/a348a59215a201eb79a8d97f4bacefd4 to your computer and use it in GitHub Desktop.
Simple neural network with 3 layers
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 | |
import math | |
inp = np.matrix([[0.9], [0.1], [0.8]]) | |
wInp = np.matrix([[0.9, 0.3, 0.4],[0.2,0.8, 0.2],[0.1,0.5,0.6]]) | |
xHid = wInp.dot(inp) | |
sigmoid = np.vectorize(lambda x: 1 / (1 + math.exp(-x))) | |
outHid = sigmoid(xHid) | |
wHidOut = np.matrix([[0.3,0.7,0.5],[0.6,0.5,0.2],[0.8,0.1,0.9]]) | |
xOut = wHidOut.dot(outHid) | |
out = sigmoid(xOut) | |
out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment