title: How to get accuracy of model using keras?
body: <p>After fitting the model (which was running for a couple of hours), I wanted to get the accuracy with the following code: </p>
  
  <pre><code>train_loss=hist.history['loss']
  val_loss=hist.history['val_loss']
  train_acc=hist.history['acc']
  val_acc=hist.history['val_acc']
  xc=range(nb_epoch)
  </code></pre>
  
  <p>of the trained model, but was getting an error, which is caused by the deprecated methods I was using. </p>
  
  <pre><code>---------------------------------------------------------------------------
  KeyError                                  Traceback (most recent call last)
  &lt;ipython-input-233-081ed5e89aa4&gt; in &lt;module&gt;()
        3 train_loss=hist.history['loss']
        4 val_loss=hist.history['val_loss']
  ----&gt; 5 train_acc=hist.history['acc']
        6 val_acc=hist.history['val_acc']
        7 xc=range(nb_epoch)
  
  KeyError: 'acc'
  </code></pre>
  
  <p>The code I used to fit the model before trying to read the accuracy, is the following: </p>
  
  <pre><code>hist = model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch,
              verbose=1, validation_data=(X_test, Y_test))
  
  
  hist = model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch, 
              verbose=1, validation_split=0.2)
  </code></pre>
  
  <p>Which produces this output when running it:</p>
  
  <pre><code>Epoch 1/20
  237/237 [==============================] - 104s 440ms/step - loss: 6.2802 - val_loss: 2.4209
      .....
      .....
      .....
  Epoch 19/20
      189/189 [==============================] - 91s 480ms/step - loss: 0.0590 - val_loss: 0.2193
      Epoch 20/20
      189/189 [==============================] - 85s 451ms/step - loss: 0.0201 - val_loss: 0.2312
  </code></pre>
  
  <p>I've noticed that I was running deprecated methods &amp; arguments. </p>
  
  <p>So how can I read the accuracy and val_accuracy without having to fit again, and waiting for a couple of hours again? I tried to replace <code>train_acc=hist.history['acc']</code> with <code>train_acc=hist.history['accuracy']</code> but it didn't help.</p>