LSTM model training in flare and data structure

I am new to Torch and I am trying to implement LSTM. Below is the code that I have. Is this the right way to implement LSTM using the rnn library, or is there anything else I need to do?

Also, what should my input data look like in LSTM? Just ordered with 2 inputs and 1 output?

require 'rnn'
require 'nn'

-- Build Model
lm = nn.Sequential()
rnn = nn.Sequencer(nn.FastLSTM(2, 30)) 
lm:add(rnn)
lm:add(nn.Linear(30, 1))

-- Train Model on 'data'
criterion = nn.MSECriterion()  
trainer = nn.StochasticGradient(lm, criterion)
trainer.learningRate = 0.01
trainer:train(data)
+4
source share

Source: https://habr.com/ru/post/1614016/


All Articles