This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build network | |
model = Sequential() | |
# add number of layer specified | |
for layer in range(N_LAYERS): | |
model.add(LSTM(N_LSTM_UNITS,input_shape=(N_TIMESTEPS,N_FEATURES),return_sequences=True)) | |
model.add(Dense(N_FEATURES)) | |
model.compile(loss='mae', optimizer='adam') | |
# print model summary | |
print(model.summary()) | |
# reshape data for training | |
print(f'... reshaping data for training ...') | |
data_train = data_reshape_for_model(data,N_TIMESTEPS,N_FEATURES) | |
# begin training iterations | |
for i in range(N_TRAIN_ITERATIONS): | |
print(f'... training iteration {i} ...') | |
model = train(model,data_train,callbacks=[LossHistory()]) | |
# get predictions on healthy data using final trained model | |
yhat = predict(model,data_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment