Code Monkey home page Code Monkey logo

lstm's Introduction

Report card

This is an LSTM implementation is pure go made with gorgonia.

The documentation is in progress.

By now, you can go get github.com/owulveryck/lstm and then run the example:

cd example/train ; go run ../../data/tontons/input.txt It will train the LSTM and predict every now and then.

TODO: the Gorgonia API has changed, I may need to asjust the solver when the 0.9 will be released

lstm's People

Contributors

owulveryck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lstm's Issues

[parser] Allow multiline equation parsing

The parser should be able to parse multi-line equations such as:

 iₜ=(Wᵢ·xₜ+Uᵢ·hₜ₋₁+Bᵢ)
 fₜ=σ(Wf·xₜ+Uf·hₜ₋₁+Bf)
 oₜ=σ(Wₒ·xₜ+Uₒ·hₜ₋₁+Bₒ)
 ĉₜ=tanh(Wc·xₜ+Uc·hₜ₋₁+Bc)
 cₜ=fₜ*cₜ₋₁+iₜ*ĉₜ
 hₜ=oₜ*tanh(cₜ)
 y=Wy·hₜ+By

And use a "Getter" to access the nodes; eg: parser.Get("y")

go build main.go

./main.go:77:26: model.Train undefined (type *lstm.Model has no field or method Train)

???

Fix go get error for gorgonia 0.9.0beta

go get github.com/owulveryck/lstm
turn out error

github.com/owulveryck/lstm

src/github.com/owulveryck/lstm/train.go:124:24: cannot use gorgonia.Nodes literal (type gorgonia.Nodes) as type []gorgonia.ValueGrad in argument to solver.Step

lstm/train.go

Line 124 in 1581884

solver.Step(G.Nodes{

diff --git a/train.go b/train.go
index b67f296..f8252aa 100644
--- a/train.go
+++ b/train.go
@@ -121,10 +121,10 @@ func (m *Model) Train(ctx context.Context, dset datasetter.FullTrainer, solver G
                                }
                                copy(hiddenT.Data().([]float32), hidden.Value().Data().([]float32))
                                copy(cellT.Data().([]float32), cell.Value().Data().([]float32))
-                               solver.Step(G.Nodes{
+                               solver.Step(G.NodesToValueGrads(G.Nodes{
                                        lstm.biasC, lstm.biasF, lstm.biasI, lstm.biasO, lstm.biasY,
                                        lstm.uc, lstm.uf, lstm.ui, lstm.uo,
-                                       lstm.wc, lstm.wf, lstm.wi, lstm.wo, lstm.wy})
+                                       lstm.wc, lstm.wf, lstm.wi, lstm.wo, lstm.wy}))
                        }
                }
        }()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.