#-----------------------------------------------------------
acc=history.history['accuracy']
val_acc=history.history['val_acc', None]
loss=history.history['loss']
val_loss=history.history['val_loss', None]
epochs=range(len(acc)) # Get number of epochs
#------------------------------------------------
and I am getting this error
KeyError Traceback (most recent call last)
<ipython-input-21-1b2da82d7eef> in <module>
4 #-----------------------------------------------------------
5 acc=history.history['accuracy']
----> 6 val_acc=history.history['val_acc', None]
7 loss=history.history['loss']
8 val_loss=history.history['val_loss', None]
KeyError: ('val_acc', None)
and this following block
`print (history.history.keys())`
outputs this:
'dict_keys(['loss', 'accuracy'])'
the dict_keys=> val_acc and val_loss is missing ....
The metric you’ve specified as part of your model training process is accuracy
and not acc
. Tensorflow adds val_
at the start to track performance on validation dataset. Please use val_accuracy
instead of val_acc
.
On a related note, the starter code correctly specifies the string as val_accuracy
. So, there was no need to change it to val_acc
.