Issue
What is the difference between these two models? Because each produce different results consistently.
Model 1
Input = tf.keras.layers.Dense(9,activation='linear')
hidden = tf.keras.layers.Dense(10,activation='relu')
hidden2 = tf.keras.layers.Dense(10,activation='relu')
output = tf.keras.layers.Dense(1, kernel_initializer='normal', activation='linear')
model = tf.keras.Sequential([Input, Dropout(0.2), hidden, Dropout(0.2), hidden2, output])
model.compile(loss='mean_squared_error', optimizer=tf.keras.optimizers.Adam(0.001))
Model 2
hidden_units1 = 9
hidden_units2 = 10
hidden_units3 = 10
model = tf.keras.Sequential([
Dense(hidden_units1, activation='linear'),
Dropout(0.2),
Dense(hidden_units2, activation='relu'),
Dropout(0.2),
Dense(hidden_units3, activation='relu'),
Dense(1, kernel_initializer='normal', activation='linear')])
model.compile(loss='mean_squared_error', optimizer=tf.keras.optimizers.Adam(0.001))
Solution
Both Models are the same, so it would be better to init one of these models and derive its weights by get_weights(), then train that model, and after that init the next model and set its weights by the wights of the previous model with set_weights(weights), it's the closest way to make the same models training performance the same.
Answered By - Soroush Mirzaei
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.