my training data set is for one user
let training = [
[[2019.1], [10]],
[[2019.2], [2]],
[[2019.4], [11]],
[[2019.5], [31]]
]
for this simple input I want to get next month prediction. To understand LSTM time series first. using below code for generating training model
let train_x = training.map(i => {return i[0]})
let train_y = training.map(j=> {return j[1]})
const model = tf.sequential();
**model.add(tf.layers.lstm({units: 128, returnSequences: false, inputShape:[train_x.length]}));**
model.add(tf.layers.dropout(0.2))
model.add(tf.layers.dense({units: training.length, activation: 'softmax'}));
model.compile({loss: 'categoricalCrossentropy', optimizer: tf.train.rmsprop(0.002)});
**const xs = tf.tensor3d([train_x]);**
const ys = tf.tensor2d(train_y, [training.length, train_y[0].length]);
Error:
Error: Input 0 is incompatible with layer lstm_LSTM1: expected ndim=3, found ndim=2
Problem is what input shape should be given and what should be tf.tensor3d input. For my understanding i am trying this simple example. Trying it without keras