Skip to content

Instantly share code, notes, and snippets.

@dean-shaff
Last active August 29, 2015 14:28
Show Gist options
  • Save dean-shaff/7f9da09965628d95c2c3 to your computer and use it in GitHub Desktop.
Save dean-shaff/7f9da09965628d95c2c3 to your computer and use it in GitHub Desktop.
feedforward step for neural net
def feed_forward(self,x):
"""
Calculate the value(s) of the neural net at the output level.
"""
y_guess = self.act(T.dot(x,self.W[0])+ self.b[0])
for i in xrange(1,len(self.W)):
W = self.W[i]
b = self.b[i]
if i == len(self.W)-1:
y_guess = T.nnet.softmax(T.dot(y_guess,W)+b)
else:
y_guess = self.act(T.dot(y_guess,W)+b)
return y_guess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment