-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodel.py
More file actions
22 lines (20 loc) · 745 Bytes
/
model.py
File metadata and controls
22 lines (20 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers import Dropout
seq = Sequential()
seq.add(LSTM(units = 16, return_sequences = True, input_shape = (X_train.shape[1], 1)))
seq.add(Dropout(0.2))
seq.add(LSTM(units = 32, return_sequences = True))
seq.add(Dropout(0.2))
seq.add(LSTM(units = 64, return_sequences = True))
seq.add(Dropout(0.2))
seq.add(LSTM(units = 64, return_sequences = True))
seq.add(Dropout(0.2))
seq.add(LSTM(units = 32, return_sequences = True))
seq.add(Dropout(0.2))
seq.add(LSTM(units = 16))
seq.add(Dropout(0.2))
seq.add(Dense(units = 1))
seq.compile(optimizer = 'adam', loss = 'mean_squared_error')
seq.fit(X_train, y_train, epochs = 100, batch_size = 32)