O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hands-On Machine Learning on Google Cloud Platform

Book Description

Unleash Google's Cloud Platform to build, train and optimize machine learning models

About This Book
  • Get well versed in GCP pre-existing services to build your own smart models
  • A comprehensive guide covering aspects from data processing, analyzing to building and training ML models
  • A practical approach to produce your trained ML models and port them to your mobile for easy access
Who This Book Is For

This book is for data scientists, machine learning developers and AI developers who want to learn Google Cloud Platform services to build machine learning applications. Since the interaction with the Google ML platform is mostly done via the command line, the reader is supposed to have some familiarity with the bash shell and Python scripting. Some understanding of machine learning and data science concepts will be handy

What You Will Learn
  • Use Google Cloud Platform to build data-based applications for dashboards, web, and mobile
  • Create, train and optimize deep learning models for various data science problems on big data
  • Learn how to leverage BigQuery to explore big datasets
  • Use Google's pre-trained TensorFlow models for NLP, image, video and much more
  • Create models and architectures for Time series, Reinforcement Learning, and generative models
  • Create, evaluate, and optimize TensorFlow and Keras models for a wide range of applications
In Detail

Google Cloud Machine Learning Engine combines the services of Google Cloud Platform with the power and flexibility of TensorFlow. With this book, you will not only learn to build and train different complexities of machine learning models at scale but also host them in the cloud to make predictions.

This book is focused on making the most of the Google Machine Learning Platform for large datasets and complex problems. You will learn from scratch how to create powerful machine learning based applications for a wide variety of problems by leveraging different data services from the Google Cloud Platform. Applications include NLP, Speech to text, Reinforcement learning, Time series, recommender systems, image classification, video content inference and many other. We will implement a wide variety of deep learning use cases and also make extensive use of data related services comprising the Google Cloud Platform ecosystem such as Firebase, Storage APIs, Datalab and so forth. This will enable you to integrate Machine Learning and data processing features into your web and mobile applications.

By the end of this book, you will know the main difficulties that you may encounter and get appropriate strategies to overcome these difficulties and build efficient systems.

Style and approach

An easy-to-follow step by step guide which will help you get to the grips with real-world applications of Google Cloud Machine Learning.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On Machine Learning on Google Cloud Platform
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Introducing the Google Cloud Platform
    1. ML and the cloud
      1. The nature of the cloud
        1. Public cloud
        2. Managed cloud versus unmanaged cloud
        3. IaaS versus PaaS versus SaaS
        4. Costs and pricing
        5. ML
    2. Introducing the GCP
      1. Mapping the GCP
    3. Getting started with GCP
      1. Project-based organization
        1. Creating your first project
        2. Roles and permissions
    4. Further reading
    5. Summary
  7. Google Compute Engine
    1. Google Compute Engine
      1. VMs, disks, images, and snapshots
      2. Creating a VM
      3. Google Shell
      4. Google Cloud Platform SDK
        1. Gcloud
        2. Gcloud config
        3. Accessing your instance with gcloud
        4. Transferring files with gcloud
      5. Managing the VM
      6. IPs
    2. Setting up a data science stack on the VM
    3. BOX the ipython console
      1. Troubleshooting
      2. Adding GPUs to instances
      3. Startup scripts and stop scripts
    4. Resources and further reading
    5. Summary
  8. Google Cloud Storage
    1. Google Cloud Storage
      1. Box–storage versus drive
    2. Accessing control lists
      1. Access and management through the web console
        1. gsutil
        2. gsutil cheatsheet
        3. Advanced gsutil
        4. Signed URLs
    3. Creating a bucket in Google Cloud Storage
      1. Google Storage namespace
        1. Naming a bucket
        2. Naming an object
      2. Creating a bucket
        1. Google Cloud Storage console
        2. Google Cloud Storage gsutil
    4. Life cycle management
    5. Google Cloud SQL
      1. Databases supported
      2. Google Cloud SQL performance and scalability
      3. Google Cloud SQL security and architecture
      4. Creating Google Cloud SQL instances
    6. Summary
  9. Querying Your Data with BigQuery
    1. Approaching big data
    2. Data structuring
    3. Querying the database
      1. SQL basics
    4. Google BigQuery
      1. BigQuery basics
      2. Using a graphical web UI
    5. Visualizing data with Google Data Studio
      1. Creating reports in Data Studio
    6. Summary
  10. Transforming Your Data
    1. How to clean and prepare the data
      1. Google Cloud Dataprep
      2. Exploring Dataprep console
      3. Removing empty cells
      4. Replacing incorrect values
      5. Mismatched values
    2. Finding outliers in the data
      1. Visual functionality
      2. Statistical information
      3. Removing outliers
    3. Run Job
    4. Scale of features
      1. Min–max normalization
      2. z score standardization
    5. Google Cloud Dataflow
    6. Summary
  11. Essential Machine Learning
    1. Applications of machine learning
      1. Financial services
      2. Retail industry
      3. Telecom industry
    2. Supervised and unsupervised machine learning
    3. Overview of machine learning techniques
      1. Objective function in regression
        1. Linear regression
        2. Decision tree
        3. Random forest
        4. Gradient boosting
        5. Neural network
        6. Logistic regression
        7. Objective function in classification
      2. Data splitting
      3. Measuring the accuracy of a model
        1. Absolute error
        2. Root mean square error
      4. The difference between machine learning and deep learning
      5. Applications of deep learning
    4. Summary
  12. Google Machine Learning APIs
    1. Vision API
      1. Enabling the API
      2. Opening an instance
        1. Creating an instance using Cloud Shell
        2. Label detection
        3. Text detection
        4. Logo detection
        5. Landmark detection
    2. Cloud Translation API
      1. Enabling the API
    3. Natural Language API
    4. Speech-to-text API
    5. Video Intelligence API
    6. Summary
  13. Creating ML Applications with Firebase
    1. Features of Firebase
      1. Building a web application
      2. Building a mobile application
    2. Summary
  14. Neural Networks with TensorFlow and Keras
    1. Overview of a neural network
      1. Setting up Google Cloud Datalab
        1. Installing and importing the required packages
      2. Working details of a simple neural network
        1. Backpropagation
      3. Implementing a simple neural network in Keras
        1. Understanding the various loss functions
        2. Softmax activation
        3. Building a more complex network in Keras
        4. Activation functions
        5. Optimizers
        6. Increasing the depth of network
        7. Impact on change in batch size
      4. Implementing neural networks in TensorFlow
        1. Using premade estimators
        2. Creating custom estimators
    2. Summary
  15. Evaluating Results with TensorBoard
    1. Setting up TensorBoard
    2. Overview of summary operations
      1. Ways to debug the code
        1. Setting up TensorBoard from TensorFlow
          1. Summaries from custom estimator
    3. Summary
  16. Optimizing the Model through Hyperparameter Tuning
    1. The intuition of hyperparameter tuning
      1. Overview of hyperparameter tuning
      2. Hyperparameter tuning in Google Cloud
        1. The model file
        2. Configuration file
        3. Setup file
        4. The __init__ file
    2. Summary
  17. Preventing Overfitting with Regularization
    1. Intuition of over/under fitting
      1. Reducing overfitting
        1. Implementing L2 regularization
        2. Implementing L1 regularization
        3. Implementing dropout
      2. Reducing underfitting
    2. Summary
  18. Beyond Feedforward Networks – CNN and RNN
    1. Convolutional neural networks
      1. Convolution layer
      2. Rectified Linear Units
      3. Pooling layers
      4. Fully connected layer
      5. Structure of a CNN
      6. TensorFlow overview
    2. Handwriting Recognition using CNN and TensorFlow
      1. Run Python code on Google Cloud Shell
    3. Recurrent neural network
      1. Fully recurrent neural networks
      2. Recursive neural networks
      3. Hopfield recurrent neural networks
      4. Elman neural networks
    4. Long short-term memory networks
    5. Handwriting Recognition using RNN and TensorFlow
      1. LSTM on Google Cloud Shell
    6. Summary
  19. Time Series with LSTMs
    1. Introducing time series 
    2. Classical approach to time series
      1. Estimation of the trend component
      2. Estimating the seasonality component
    3. Time series models
      1. Autoregressive models
      2. Moving average models
      3. Autoregressive moving average model 
      4. Autoregressive integrated moving average models
    4. Removing seasonality from a time series
      1. Analyzing a time series dataset
      2. Identifying a trend in a time series
      3. Time series decomposition
        1. Additive method
        2. Multiplicative method
    5. LSTM for time series analysis
      1. Overview of the time series dataset
      2. Data scaling
      3. Data splitting
      4. Building the model
      5. Making predictions
    6. Summary
  20. Reinforcement Learning
    1. Reinforcement learning introduction
      1. Agent-Environment interface
      2. Markov Decision Process
      3. Discounted cumulative reward
      4. Exploration versus exploitation
    2. Reinforcement learning techniques
      1. Q-learning
      2. Temporal difference learning
      3. Dynamic Programming
      4. Monte Carlo methods
      5. Deep Q-Network
    3. OpenAI Gym
    4. Cart-Pole system
      1. Learning phase
      2. Testing phase
    5. Summary
  21. Generative Neural Networks
    1. Unsupervised learning
    2. Generative models
      1. Restricted Boltzmann machine
        1. Boltzmann machine architecture
        2. Boltzmann machine disadvantages
      2. Deep Boltzmann machines
      3. Autoencoder
      4. Variational autoencoder
      5. Generative adversarial network
      6. Adversarial autoencoder 
    3. Feature extraction using RBM
      1. Breast cancer dataset
      2. Data preparation
      3. Model fitting
    4. Autoencoder with Keras
      1. Load data
      2. Keras model overview
        1. Sequential model
        2. Keras functional API
      3. Define model architecture
    5. Magenta
      1. The NSynth dataset
    6. Summary
  22. Chatbots
    1. Chatbots fundamentals
      1. Chatbot history
        1. The imitation game
        2. Eliza
        3. Parry
        4. Jabberwacky
        5. Dr. Sbaitso
        6. ALICE
        7. SmarterChild
        8. IBM Watson
      2. Building a bot
        1. Intents
        2. Entities
        3. Context
      3. Chatbots
        1. Essential requirements
        2. The importance of the text
        3. Word transposition
        4. Checking a value against a pattern
        5. Maintaining context
      4. Chatbots architecture
      5. Natural language processing
      6. Natural language understanding
    2. Google Cloud Dialogflow
      1. Dialogflow overview
      2. Basics Dialogflow elements
        1. Agents
        2. Intent
        3. Entity
        4. Action
        5. Context
      3. Building a chatbot with Dialogflow
        1. Agent creation
        2. Intent definition
    3. Summary