Suppose I have these two models (model1
and model2
) trained from same structured data, but different datasets:
# create and fit the LSTM network on dataset1
model = Sequential()
model.add(LSTM(4, input_shape=(look_back, 6)))
model.add(Dense(1))
optimizer = Adam(lr=0.001, decay=0.00001)
model.compile(loss='mean_squared_error', optimizer=optimizer)
model.summary()
model1 = model.fit(trainX, trainY, epochs=100, batch_size=64, verbose=2)
model1.save_weights("Model1.h5")
# create and fit the LSTM network on dataset2
model = Sequential()
model.add(LSTM(4, input_shape=(look_back, 6)))
model.add(Dense(1))
optimizer = Adam(lr=0.001, decay=0.00001)
model.compile(loss='mean_squared_error', optimizer=optimizer)
model.summary()
model2 = model.fit(trainX, trainY, epochs=100, batch_size=64, verbose=2)
model2.save_weights("Model2.h5")
How do I combine Model1.h5
and Model2.h5
to make suppose Model3.h5
which has all the attributes of Model1.h5
and Model2.h5
?
Any help will be highly appreciated.
Thanks,