Let's consider, I have four models following as M1 (client 1), M2 (client 2), M3 (client 3), and M4 (client 4). Each model has a similar structure.
After training for each client model. I have aggregated these models together and create a new model which is let's say "EnsModel". After that, I have used this ensemble model to retrain new data for each client again. However, when I tried to ensemble the updated models again, I faced this problem that says "ValueError: The name "Sequential" is used 4 times in the model. All the layer names should be unique?"
Can anybody help me out? I also have one question. Is there any way that I can model modify the ensemble model structure for each client?
Thank you.
try to name each model and then merge them as right down below.
M1.name = 'Client1'
M2.name = 'Client2'
M3.name = 'Client3'
M4.name = 'Client4'
commonInput = Input((x, x, y))
outM1 = M1(commonInput)
outM2 = M2(commonInput)
// outM3
// outM4 also like the first two
mergedM1M2 = keras.layers.Add()([outM1,outM2])
//mergedM3M4
FinalMerged = keras.layers.Add()([mergedM1M2,mergedM3M4])
FinalModel = Model(commonInput, Finalmerged)