haskell icon indicating copy to clipboard operation
haskell copied to clipboard

RNN example?

Open alexanderkjeldaas opened this issue 9 years ago • 13 comments

I'd love to see an RNN example.

alexanderkjeldaas avatar Dec 26 '16 20:12 alexanderkjeldaas

Do you have a learning problem an a data set in mind that would be interesting?

blackgnezdo avatar Dec 26 '16 20:12 blackgnezdo

A chatbot trained on the ubuntu dialogue corpus would be a great example.

alexanderkjeldaas avatar Dec 26 '16 20:12 alexanderkjeldaas

I like the data set, it seems to have non-trivial size. I found The Ubuntu Dialogue Corpus: A Large Dataset for Research in Unstructured Multi-Turn Dialogue Systems paper which references the logs. The logs are in text form. Do you know of a more structured representation of the same data? A big part of an ML system is pre-processing the raw data into a form which can be efficiently consumed by the learner. This is also a piece of the puzzle which is currently not easily expressed in TensorFlow.

I found this ubuntu-ranking-dataset-creator but it seems to be preparing the data for a ranking problem and not a chatbot.

blackgnezdo avatar Dec 26 '16 21:12 blackgnezdo

Could https://github.com/brmson/dataset-sts/tree/master/data/anssel/ubuntu be used?

alexanderkjeldaas avatar Dec 26 '16 21:12 alexanderkjeldaas

How should it be expressed?

alexanderkjeldaas avatar Dec 26 '16 22:12 alexanderkjeldaas

This series of blog posts uses the reddit data set http://lauragelston.ghost.io/speakeasy-pt1/ The code is here: https://github.com/Charging-Alot/SpeakEasy-AI Maybe porting that could be a useful example? Or porting the english-french example from tensorflow that they based their system on.

alexanderkjeldaas avatar Dec 26 '16 23:12 alexanderkjeldaas

Replicating this seq2seq setup is an alternative: https://github.com/spro/intense

alexanderkjeldaas avatar Dec 27 '16 00:12 alexanderkjeldaas

Another alternative, replicating code like this: https://gist.github.com/nivwusquorum/b18ce332bde37e156034e5d3f60f8a23 and https://gist.github.com/nivwusquorum/160d5cf7e1e82c21fad3ebf04f039317

alexanderkjeldaas avatar Dec 27 '16 16:12 alexanderkjeldaas

Hi @blackgnezdo and @alexanderkjeldaas , great idea,

I think starting with LSTM is not the most simplest example though, maybe the simplest RNN that works well is a GRU?

Here's some starter code,

https://github.com/suriyadeepan/rnn-from-scratch/blob/master/gru.py

Would be great for people to learn Haskel-TF from a useful example :+1:

ajaytalati avatar Apr 30 '17 18:04 ajaytalati

Looking at the GRU example, it seems that current TF Haskell version does not support all functions used in the code above. Maybe I am wrong ? Do you have any insights to get started ?

delanoe avatar Jul 26 '17 13:07 delanoe

Enough is supported to implement an "unrolled" RNN with a fixed length. If you are brave, I have a WIP RNN example here: https://github.com/fkm3/tensorflow-haskell/blob/dqn/tensorflow-mnist/app/Seq.hs

It is using an LSTM, but there is also a GRU implementation in https://github.com/fkm3/tensorflow-haskell/blob/dqn/tensorflow-ops/src/TensorFlow/RNN.hs#L42

I'm distracted by my day job right now, so it might be a while before I finish it up and send the various pieces for review.

fkm3 avatar Jul 26 '17 15:07 fkm3

Many thanks for your answer. This script helps to understand how to use the lib.

delanoe avatar Jul 28 '17 19:07 delanoe

Can someone share a working LSTM example? Many thanks in advance!

rikvdkleij avatar Sep 06 '18 16:09 rikvdkleij