Book Image

The Applied TensorFlow and Keras Workshop

By : Harveen Singh Chadha, Luis Capelo
Book Image

The Applied TensorFlow and Keras Workshop

By: Harveen Singh Chadha, Luis Capelo

Overview of this book

Machine learning gives computers the ability to learn like humans. It is becoming increasingly transformational to businesses in many forms, and a key skill to learn to prepare for the future digital economy. As a beginner, you’ll unlock a world of opportunities by learning the techniques you need to contribute to the domains of machine learning, deep learning, and modern data analysis using the latest cutting-edge tools. The Applied TensorFlow and Keras Workshop begins by showing you how neural networks work. After you’ve understood the basics, you will train a few networks by altering their hyperparameters. To build on your skills, you’ll learn how to select the most appropriate model to solve the problem in hand. While tackling advanced concepts, you’ll discover how to assemble a deep learning system by bringing together all the essential elements necessary for building a basic deep learning system - data, model, and prediction. Finally, you’ll explore ways to evaluate the performance of your model, and improve it using techniques such as model evaluation and hyperparameter optimization. By the end of this book, you'll have learned how to build a Bitcoin app that predicts future prices, and be able to build your own models for other projects.
Table of Contents (6 chapters)

3. Real-World Deep Learning: Evaluating the Bitcoin Model

Activity 3.01: Optimizing a Deep Learning Model

Solution:

  1. Using your Terminal, start a TensorBoard instance by executing the following command:
    $ cd ./Chapter03/Activity3.01/
    $ tensorboard --logdir=logs/

    You will see the SCALARS page once TensorBoard opens in the browser:

    Figure 3.20: Screenshot of a TensorBoard showing SCALARS page

  2. Open the URL that appears on screen and leave that browser tab open as well. Also, start a Jupyter Notebook instance with the following command:
    $ jupyter-lab

    Here's the screenshot showing the Jupyter Notebook:

    Figure 3.21: Jupyter Notebook

    Open the URL that appears in a different browser window.

  3. Now, open the Jupyter Notebook called Activity3.01_Optimizing_a_deep_learning_model.ipynb and navigate to the title of the Notebook. Run the cell to, import all the required libraries.
  4. Set the seed to avoid randomness:
    np.random.seed(0)

    We will load the train and test data like we did...