Comments (4)
Replace the forwardProp function to:
def forwardProp(self):
#loop through recurrences - start at 1 so the 0th entry of all arrays will be an array of 0's
for i in range(1, self.rl+1):
#set input for LSTM cell, combination of input (previous output) and previous hidden state
self.LSTM.x = np.hstack((self.ha[i-1], self.x))
#run forward prop on the LSTM cell, retrieve cell state and hidden state
cs, hs, f, inp, c, o = self.LSTM.forwardProp()
#store input
maxI = np.argmax(self.x)
self.x = np.zeros_like(self.x)
self.x[maxI] = 1
self.ia[i] = self.x #Use np.argmax?
#store cell state
self.ca[i] = cs
#store hidden state
self.ha[i] = hs
self.af[i] = f
self.ai[i] = inp
self.ac[i] = c
self.ao[i] = o
#calculate output by multiplying hidden state with weight matrix
self.oa[i] = self.sigmoid(np.dot(self.w, hs))
self.x = self.eo[i-1]
#return all outputs
return self.oa
from lstm_networks.
Folks, just go here: https://github.com/kevin-bruhwiler/Simple-Vanilla-LSTM/blob/master/VanillaLSTM.py
from lstm_networks.
When I run the last part I get:
`ValueError Traceback (most recent call last)
in ()
12 for i in range(1, iterations):
13 #compute predicted next word
---> 14 RNN.forwardProp()
15 #update all our weights using our error
16 error = RNN.backProp()
in forwardProp(self)
53 for i in range(1, self.rl+1):
54 self.LSTM.x = np.hstack((self.ha[i-1], self.x))
---> 55 cs, hs, f, c, o = self.LSTM.forwardProp()
56 #store computed cell state
57 self.ca[i] = cs
ValueError: too many values to unpack (expected 5)
`
from lstm_networks.
Hi,guys ,I think there is something missed in this sentence: "dphs = np.dot(dc, self.c)[:self.ys] + np.dot(do, self.o)[:self.ys] + np.dot(di, self.i)[:self.ys] + np.dot(df, self.f)[:self.ys]". It should be :
dphs = np.dot(np.dot(dc, dtangent(c)), self.c)[:self.ys] +
np.dot(np.dot(do, dsigmoid(o)), self.o)[:self.ys] +
np.dot(np.dot(di, dsigmoid(i)), self.i)[:self.ys] +
np.dot(np.dot(df, dsigmoid(f)), self.f)[:self.ys]
I don't know if I understand wrong? hope you guys can help with that, thanks!
from lstm_networks.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lstm_networks.