Skip to content

Instantly share code, notes, and snippets.

@RANUX
Created November 23, 2017 13:15
Show Gist options
  • Save RANUX/3441547c536ea523b5197289ee44f2cd to your computer and use it in GitHub Desktop.
Save RANUX/3441547c536ea523b5197289ee44f2cd to your computer and use it in GitHub Desktop.
Very simple 2 layer neural network
import numpy as np
import math
inp = np.matrix([[1.0], [0.5]])
weights = np.matrix([[0.9, 0.3],[0.2,0.8]])
x = weights.dot(inp)
sigmoid = np.vectorize(lambda x: 1 / (1 + math.exp(-x)))
sigmoid(x)
#out.append(sigmoid(np.array(wsum)[0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment