I am very new to machine-learning and keras and was stuck on trying to input data; I have data which looks like:
[[[0.01363717 0. ]
[0.01577874 0. ]
[0.01463021 0. ]]
[[0.01577874 0. ]
[0.01463021 0. ]
[0.01006721 0. ]]
[[0.01463021 0. ]
[0.01006721 0. ]
[0.00762504 0. ]]...]
The data's shape is: (1607, 3, 2). How can I pass:
[[0.01363717 0. ]
[0.01577874 0. ]
[0.01463021 0. ]]
as an input in a layer of 512 CuDNNLSTM cells?
Here is my whole network:
def create_model():
model = Sequential()
model.add(CuDNNLSTM(512, input_shape=(3,2), return_sequences=True, name='inputlstm1'))
model.add(Dropout(0.2))
model.add(CuDNNLSTM(512, return_sequences=True,name='lstm2'))
model.add(Dropout(0.2))
model.add(CuDNNLSTM(512, return_sequences=True,name='lstm3'))
model.add(Dropout(0.2))
model.add(Dense(32, activation='relu', name='dense1'))
model.add(Dropout(0.2))
model.add(Dense(1, activation='softmax', name='denseoutput2'))
# Compile model
model.compile(
loss='mse',
optimizer='adam',
metrics=['accuracy'],
)
return model
And its fitting:
model=create_model()
history=model.fit(xtrain, ytrain,batch_size=1, epochs=5, validation_data=(xtest, ytest), verbose=1)