Hands-on exercise – training a TensorFlow model
In this exercise, you will learn how to install the TensorFlow library in your local Jupyter environment and build and train a simple neural network model. Launch a Jupyter notebook that you have previously installed on your machine. If you don't remember how to do this, visit the Hands-on lab section of Chapter 3, Machine Learning Algorithms.
Once the Jupyter notebook is running, create a new folder by selecting the New dropdown and then Folder. Rename the folder TensorFlowLab
. Open the TensorFlowLab
folder, create a new notebook inside this folder, and rename the notebook Tensorflow-lab1.ipynb
. Now, let's get started:
- Inside the first cell, run the following code to install TensorFlow:
! pip3 install --upgrade tensorflow
- Now, we must import the library and load the sample training data. We will use the built-in
fashion_mnist
dataset that comes with thekeras
library to do so. Next, we must load the data...