title: Introduction to Deep Learning with Keras: 'X_train' is not defined?
body: <p>So I'm trying to better understand deep learning through Keras. I've installed python, pip, tensorflow, and jupyter notebook to run this with, but based on the following example from "Introduction to Deep Learning with Keras" from towardsdatascience.com, I've already run into an error. Sorry if this seems very obvious, but this is the first time I've done something with this, and it's difficult to gauge the problem when the very first example you've ever ran somehow has an error in it.</p>
  
  <p>The first block of code given is:</p>
  
  <pre><code>from keras.datasets import mnist
  
  (x_train, y_train), (x_test, y_test) = mnist.load_data()
  </code></pre>
  
  <p>Which states that it is using TensorFlow backend.
  The second block of code given is:</p>
  
  <pre><code>x_train = x_train.astype('float32')
  x_test = x_test.astype('float32')
  x_train /= 255
  x_test /= 255
  
  x_train = X_train.reshape(X_train.shape[0], 28, 28, 1)
  x_test = X_test.reshape(X_test.shape[0], 28, 28, 1)
  </code></pre>
  
  <p>Which gives the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  &lt;ipython-input-2-e2db9b91827f&gt; in &lt;module&gt;
        4 x_test /= 255
        5 
  ----&gt; 6 x_train = X_train.reshape(X_train.shape[0], 28, 28, 1)
        7 x_test = X_test.reshape(X_test.shape[0], 28, 28, 1)
  
  NameError: name 'X_train' is not defined
  </code></pre>
  
  <p>Here's a screenshot of these two parts: <a href="https://i.stack.imgur.com/CadEj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CadEj.png" alt="enter image description here"></a></p>
  
  <p>I don't see how x_train couldn't be defined in this situation however, as there's clearly a line that states "x_train = x_train.astype('float32')"</p>