[英]Which parameter configuration is Keras using by default for predictions after training a model for multiple epochs
I have a general question about Keras.我有一个关于 Keras 的一般性问题。 When training a Artificial Neural Network (eg a Multi-Layer-Perceptron or a LSTM) with a split of training, validation and test data (eg 70 %, 20 %, 10 %), I would like to know which parameter configuration the trained model is eventually using for predictions?在训练具有训练、验证和测试数据(例如 70%、20%、10%)拆分的人工神经网络(例如多层感知器或 LSTM)时,我想知道训练的参数配置model 最终用于预测?
Here I have an exmaple from a training process with 11 epoch:在这里,我有一个来自 11 个 epoch 的训练过程的示例:
I could think about 3 possible parameter configurations (surely there are also others):我可以考虑 3 种可能的参数配置(当然还有其他的):
If you just build the model without for example like this:如果您只是构建 model 而没有像这样:
# Build the model and train it
optimizer_adam = tf.keras.optimizers.Adam(lr= 0.001)
model = keras.models.Sequential([
keras.layers.LSTM(10, return_sequences=True, input_shape=[None, numberOfInputFeatures]),
keras.layers.LSTM(10, return_sequences=True),
keras.layers.TimeDistributed(keras.layers.Dense(numberOfOutputNeurons))
])
model.compile(loss="mean_squared_error", optimizer=optimizer_adam, metrics=['mean_absolute_percentage_error'])
history = model.fit(X_train, Y_train, epochs=11, batch_size=10, validation_data=(X_valid, Y_valid))
# Predict the values from the test dataset
Y_pred = model.predict(X_test)
Can you tell me which configuration is used for predicting the values from the test dataset in the line Y_pred = model.predict(X_test)
?您能告诉我使用哪种配置来预测Y_pred = model.predict(X_test)
行中的测试数据集的值吗?
It would be the configuration after the last epoch (the 2nd possible configuration that you have mentioned).这将是最后一个时期之后的配置(您提到的第二个可能的配置)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.