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)

2. Real-World Deep Learning: Predicting the Price of Bitcoin

Activity 2.01: Assembling a Deep Learning System

Solution:

We will continue to use Jupyter Notebooks and the data prepared in previous exercises of chapter 2 (data/train_dataset.csv), as well as the model that we stored locally (bitcoin_ lstm_v0.h5):

  1. Import the libraries required to load and train the deep learning model:
    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt
    %matplotlib inline
    from tensorflow.keras.models import load_model
    plt.style.use('seaborn-white')

    Note

    The close_point_relative_normalization variable will be used to train our LSTM model.

    We will start by loading the dataset we prepared during our previous activities. We'll use pandas to load that dataset into memory.

  2. Load the training dataset into memory using pandas, as follows:
    train = pd.read_csv('data/train_dataset.csv')
  3. Now, quickly inspect the dataset by executing the following command...