I have constructed, fitted, and saved the following model:
def build_Lstm_model(train_x,train_y,test_x,test_y):
inp = Input(shape=(train_x.shape[1],train_x.shape[2]))
rnn_1st_model = LSTM(units=60, return_sequences=True,recurrent_dropout=0.1)(inp)
rnn_2nd_model = LSTM(units=60,recurrent_dropout=0.1)(rnn_1st_model)
dense_layer = Dense(128)(rnn_2nd_model)
drop_out = Dropout(0.2)(dense_layer)
output = Dense(1, activation= LeakyReLU(alpha=0.1),name="class")(drop_out)
model = Model(inp, output)
callbacks = [ReduceLROnPlateau(monitor='val_loss', patience=4, verbose=1, factor=0.6),
EarlyStopping(monitor='val_loss', patience=20),
ModelCheckpoint(filepath='model_LSTM.h5', monitor='val_loss', save_best_only=True)]
model.summary()
model.compile(loss='binary_crossentropy', optimizer="adam", metrics=['accuracy'])
history = model.fit(train_x, train_y,
epochs = 8,
batch_size = 128,
validation_data=(test_x, test_y),
callbacks=callbacks)
return history,model
I am using the load_model function for deployment, and I am now getting the following error:
ValueError: Unknown activation function: LeakyReLU