为什么来自model.fit的输出中的val_accuracy与model.history.history ['val_accuracy']相同?

时间:2020-05-27 22:37:39

标签: python machine-learning tf.keras

我的代码:

history=model.fit(X_train, y_train, validation_data=(X_val,y_val),epochs=10, verbose=0,callbacks=[callbacks])
xyz=model.history.history['val_accuracy']
print(xyz)

根据我的理解,model.fit输出中的val_accuracy值应与model.history.history ['val_accuracy']中的值相同。我要去哪里错了?

输出:

Model: "sequential"
_________________________________________________________________
Layer (type)                  Output Shape              Param #   
=================================================================
dense (Dense)                (None, 15)                240       
_________________________________________________________________
dense_1 (Dense)              (None, 15)                240       
_________________________________________________________________
dense_2 (Dense)              (None, 1)                 16        
=================================================================
Total params: 496
Trainable params: 496
Non-trainable params: 0
_________________________________________________________________
validation accuracy : 57.00% 
training accuracy   : 49.82% 

[0.5699999928474426, 0.5899999737739563, 0.550000011920929, 0.550000011920929, 0.5299999713897705, 0.5199999809265137, 0.5199999809265137, 0.5199999809265137, 0.5099999904632568, 0.5]
---------------------------------------------------------------------------

0 个答案:

没有答案