ebook img

the APPLIED TENSORFLOW AND KERAS WORKSHOP - build your practical skills by working through a real... -world project - a bitcoin price prediction tracke. PDF

173 Pages·2020·9.944 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview the APPLIED TENSORFLOW AND KERAS WORKSHOP - build your practical skills by working through a real... -world project - a bitcoin price prediction tracke.

The Applied TensorFlow and Keras Workshop Develop your practical skills by working through a real-world project and build your own Bitcoin price prediction tracker Harveen Singh Chadha and Luis Capelo The Applied TensorFlow and Keras Workshop Copyright © 2020 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Authors: Harveen Singh Chadha and Luis Capelo Reviewers: Abhranshu Bagchi, Achint Chaudhary, Vishal Chauhan, Alexis Rutherford, and Subhash Sundaravadivelu Managing Editor: Anushree Arun Tendulkar Acquisitions Editors: Sneha Shinde and Karan Wadekar Production Editor: Roshan Kawale Editorial Board: Megan Carlisle, Samuel Christa, Mahesh Dhyani, Heather Gopsill, Manasa Kumar, Alex Mazonowicz, Monesh Mirpuri, Bridget Neale, Dominic Pereira, Shiny Poojary, Abhishek Rane, Brendan Rodrigues, Erol Staveley, Ankita Thakur, Nitesh Thakur, and Jonathan Wray First published: July 2020 Production reference: 1290720 ISBN: 978-1-80020-121-7 Published by Packt Publishing Ltd. Livery Place, 35 Livery Street Birmingham B3 2PB, UK Table of Contents Preface i Chapter 1: Introduction to Neural Networks and Deep Learning 1 Introduction .............................................................................................. 2 What are Neural Networks? ................................................................... 2 Successful Applications of Neural Networks ............................................ 3 Why Do Neural Networks Work So Well? .............................................. 6 Representation Learning ............................................................................ 6 Function Approximation ............................................................................. 7 Limitations of Deep Learning ..................................................................... 8 Inherent Bias and Ethical Considerations ................................................. 9 Common Components and Operations of Neural Networks ............... 10 Configuring a Deep Learning Environment ....................................... 12 Software Components for Deep Learning .............................................. 12 Python 3 ...............................................................................................................13 TensorFlow ..........................................................................................................13 Keras .....................................................................................................................13 TensorBoard ........................................................................................................14 Jupyter Notebook, Pandas, and NumPy ..........................................................14 Exercise 1.01: Verifying the Software Components ............................... 16 Exploring a Trained Neural Network .................................................. 22 The MNIST Dataset .................................................................................... 23 Training a Neural Network with TensorFlow ......................................... 25 Exercise 1.02: Training a Neural Network Using the MNIST Dataset .. 26 Testing Network Performance with Unseen Data ................................. 28 Activity 1.01: Training a Neural Network with Different Hyperparameters ....................................................................................... 30 Summary ................................................................................................ 31 Chapter 2: Real-World Deep Learning: Predicting the Price of Bitcoin 33 Introduction ........................................................................................... 34 Choosing the Right Model Architecture ............................................. 34 Convolutional Neural Networks (CNNs) ................................................. 35 Recurrent Neural Networks (RNNs) ........................................................ 36 Long Short-Term Memory (LSTM) Networks .......................................... 37 Generative Adversarial Networks ............................................................ 38 Deep Reinforcement Learning (DRL) ....................................................... 40 Data Normalization ................................................................................... 41 Z-Score .................................................................................................................42 Point-Relative Normalization ............................................................................42 Maximum and Minimum Normalization .........................................................43 Structuring Your Problem .................................................................... 44 Jupyter Notebook ....................................................................................... 46 Exercise 2.01: Exploring the Bitcoin Dataset and Preparing Data for a Model ........................................................................................ 46 Using Keras as a TensorFlow Interface .............................................. 56 Model Components ................................................................................... 56 Exercise 2.02: Creating a TensorFlow Model Using Keras ..................... 59 From Data Preparation to Modeling .................................................. 61 Training a Neural Network ....................................................................... 62 Reshaping Time Series Data ..................................................................... 64 Making Predictions .................................................................................... 67 Overfitting ...........................................................................................................67 Activity 2.01: Assembling a Deep Learning System ............................... 68 Summary ................................................................................................ 69 Chapter 3: Real-World Deep Learning: Evaluating the Bitcoin Model 71 Introduction ........................................................................................... 72 Problem Categories ................................................................................... 72 Loss Functions, Accuracy, and Error Rates ............................................. 73 Different Loss Functions, Same Architecture ......................................... 75 Using TensorBoard .................................................................................... 78 Implementing Model Evaluation Metrics ................................................ 79 Evaluating the Bitcoin Model .................................................................... 81 Overfitting ................................................................................................... 83 Model Predictions ...................................................................................... 83 Interpreting Predictions ............................................................................ 85 Exercise 3.01: Creating an Active Training Environment ...................... 87 Hyperparameter Optimization ........................................................... 93 Layers and Nodes – Adding More Layers ................................................ 93 Adding More Nodes ............................................................................................94 Layers and Nodes – Implementation ...................................................... 94 Epochs ......................................................................................................... 96 Epochs – Implementation ..................................................................................96 Activation Functions .................................................................................. 97 Linear (Identity) Functions ........................................................................ 97 Hyperbolic Tangent (Tanh) Function ................................................................98 Rectified Linear Unit Functions .........................................................................99 Activation Functions – Implementation ................................................ 100 Regularization Strategies ........................................................................ 101 L2 Regularization ..............................................................................................101 Dropout ..............................................................................................................102 Regularization Strategies – Implementation .................................................102 Optimization Results ............................................................................... 103 Activity 3.01: Optimizing a Deep Learning Model ................................ 104 Summary .............................................................................................. 105 Chapter 4: Productization 107 Introduction ......................................................................................... 108 Handling New Data ............................................................................. 108 Separating Data and Model .................................................................... 108 The Data Component .............................................................................. 109 The Model Component ............................................................................ 109 Dealing with New Data ............................................................................ 110 Retraining an Old Model ..................................................................................111 Training a New Model ......................................................................................112 Exercise 4.01: Retraining a Model Dynamically .................................... 113 Deploying a Model as a Web Application .............................................. 119 Application Architecture and Technologies ......................................... 120 Exercise 4.02: Deploying and Using Cryptonic ..................................... 121 Activity 4.01: Deploying a Deep Learning Application ......................... 125 Summary .............................................................................................. 127 Appendix 129 Index 153 Preface

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.