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

TensorFlow Machine Learning Projects

Book Description

Implement TensorFlow's offerings such as TensorBoard, TensorFlow.js, TensorFlow Probability, and TensorFlow Lite to build smart automation projects

Key Features

  • Use machine learning and deep learning principles to build real-world projects
  • Get to grips with TensorFlow's impressive range of module offerings
  • Implement projects on GANs, reinforcement learning, and capsule network

Book Description

TensorFlow has transformed the way machine learning is perceived. TensorFlow Machine Learning Projects teaches you how to exploit the benefits—simplicity, efficiency, and flexibility—of using TensorFlow in various real-world projects. With the help of this book, you'll not only learn how to build advanced projects using different datasets but also be able to tackle common challenges using a range of libraries from the TensorFlow ecosystem.

To start with, you'll get to grips with using TensorFlow for machine learning projects; you'll explore a wide range of projects using TensorForest and TensorBoard for detecting exoplanets, TensorFlow.js for sentiment analysis, and TensorFlow Lite for digit classification.

As you make your way through the book, you'll build projects in various real-world domains, incorporating natural language processing (NLP), the Gaussian process, autoencoders, recommender systems, and Bayesian neural networks, along with trending areas such as Generative Adversarial Networks (GANs), capsule networks, and reinforcement learning. You'll learn how to use the TensorFlow on Spark API and GPU-accelerated computing with TensorFlow to detect objects, followed by how to train and develop a recurrent neural network (RNN) model to generate book scripts.

By the end of this book, you'll have gained the required expertise to build full-fledged machine learning projects at work.

What you will learn

  • Understand the TensorFlow ecosystem using various datasets and techniques
  • Create recommendation systems for quality product recommendations
  • Build projects using CNNs, NLP, and Bayesian neural networks
  • Play Pac-Man using deep reinforcement learning
  • Deploy scalable TensorFlow-based machine learning systems
  • Generate your own book script using RNNs

Who this book is for

TensorFlow Machine Learning Projects is for you if you are a data analyst, data scientist, machine learning professional, or deep learning enthusiast with basic knowledge of TensorFlow. This book is also for you if you want to build end-to-end projects in the machine learning domain using supervised, unsupervised, and reinforcement learning techniques

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. TensorFlow Machine Learning Projects
  3. Dedication
  4. About Packt
    1. Why subscribe?
    2. Packt.com
  5. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  6. 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
  7. 1: Overview of TensorFlow and Machine Learning
    1. What is TensorFlow?
    2. The TensorFlow core
      1. Tensors
      2. Constants
      3. Operations
      4. Placeholders
      5. Tensors from Python objects
      6. Variables
      7. Tensors generated from library functions
      8. Obtaining variables with the tf.get_variable()
    3. Computation graph
      1. The order of execution and lazy loading
      2. Executing graphs across compute devices – CPU and GPGPU
        1. Placing graph nodes on specific compute devices
        2. Simple placement
        3. Dynamic placement
        4. Soft placement
        5. GPU memory handling
      3. Multiple graphs
    4. Machine learning, classification, and logistic regression
      1. Machine learning
      2. Classification
      3. Logistic regression for binary classification
      4. Logistic regression for multiclass classification
    5. Logistic regression with TensorFlow
    6. Logistic regression with Keras
    7. Summary
    8. Questions
    9. Further reading
  8. 2: Using Machine Learning to Detect Exoplanets in Outer Space
    1. What is a decision tree?
    2. Why do we need ensembles?
    3. Decision tree-based ensemble methods
      1. Random forests
      2. Gradient boosting
    4. Decision tree-based ensembles in TensorFlow
      1. TensorForest Estimator
      2. TensorFlow boosted trees estimator
    5. Detecting exoplanets in outer space
    6. Building a TFBT model for exoplanet detection
    7. Summary
    8. Questions
    9. Further reading
  9. 3: Sentiment Analysis in Your Browser Using TensorFlow.js
    1. Understanding TensorFlow.js
    2. Understanding Adam Optimization
    3. Understanding categorical cross entropy loss
    4. Understanding word embeddings
    5. Building the sentiment analysis model
      1. Pre-processing data
      2. Building the model
    6. Running the model on a browser using TensorFlow.js
    7. Summary
    8. Questions
  10. 4: Digit Classification Using TensorFlow Lite
    1. What is TensorFlow Lite?
    2. Classification Model Evaluation Metrics
    3. Classifying digits using TensorFlow Lite
      1. Pre-processing data and defining the model
      2. Converting TensorFlow model to TensorFlow Lite
    4. Summary
    5. Questions
  11. 5: Speech to Text and Topic Extraction Using NLP
    1. Speech-to-text frameworks and toolkits
    2. Google Speech Commands Dataset
    3. Neural network architecture
      1. Feature extraction module
      2. Deep neural network module
    4. Training the model
    5. Summary
    6. Questions
    7. Further reading
  12. 6: Predicting Stock Prices using Gaussian Process Regression
    1. Understanding Bayes' rule
    2.  Introducing Bayesian inference
    3. Introducing Gaussian processes
      1. Choosing kernels in GPs
        1. Choosing the hyper parameters of a kernel
    4. Applying GPs to stock market prediction
    5. Creating a stock price prediction model
    6. Understanding the results obtained
    7. Summary
    8. Questions
  13. 7: Credit Card Fraud Detection using Autoencoders
    1. Understanding auto-encoders
    2. Building a fraud detection model
      1. Defining and training a fraud detection model 
      2. Testing a fraud detection model
    3. Summary
    4. Questions
  14. 8: Generating Uncertainty in Traffic Signs Classifier Using Bayesian Neural Networks
    1. Understanding Bayesian deep learning
      1. Bayes' rule in neural networks
    2. Understanding TensorFlow probability, variational inference, and Monte Carlo methods
    3. Building a Bayesian neural network
      1. Defining, training, and testing the model
    4. Summary
    5. Questions
  15. 9: Generating Matching Shoe Bags from Shoe Images Using DiscoGANs
    1. Understanding generative models
      1. Training GANs
      2. Applications
      3. Challenges
    2. Understanding DiscoGANs
      1. Fundamental units of a DiscoGAN
      2. DiscoGAN modeling
    3. Building a DiscoGAN model
    4. Summary
    5. Questions
  16. 10: Classifying Clothing Images using Capsule Networks
    1. Understanding the importance of capsule networks
    2. Understanding capsules
      1. How do capsules work?
    3. The dynamic routing algorithm
    4. CapsNet for classifying Fashion MNIST images
      1. CapsNet implementation
        1. Understanding the encoder
        2. Understanding the decoder
        3. Defining the loss function
    5. Training and testing the model
    6. Reconstructing sample images
    7. Limitations of capsule networks
    8. Summary
  17. 11: Making Quality Product Recommendations Using TensorFlow
    1. Recommendation systems
    2. Content-based filtering
      1. Advantages of content-based filtering algorithms
      2. Disadvantages of content-based filtering algorithms
    3. Collaborative filtering
    4. Hybrid systems
    5. Matrix factorization
    6. Introducing the Retailrocket dataset
    7. Exploring the Retailrocket dataset
    8. Pre-processing the data
    9. The matrix factorization model for Retailrocket recommendations
    10. The neural network model for Retailrocket recommendations
    11. Summary
    12. Questions
    13. Further reading
  18. 12: Object Detection at a Large Scale with TensorFlow
    1. Introducing Apache Spark
    2. Understanding distributed TensorFlow
      1. Deep learning through distributed TensorFlow
    3. Learning about TensorFlowOnSpark
      1. Understanding the architecture of TensorFlowOnSpark 
      2. Deep delving inside the TFoS API
      3. Handwritten digits using TFoS
    4. Object detection using TensorFlowOnSpark and Sparkdl
      1. Transfer learning
      2. Understanding the Sparkdl interface 
      3. Building an object detection model
    5. Summary
  19. 13: Generating Book Scripts Using LSTMs
    1. Understanding recurrent neural networks
    2. Pre-processing the data
    3. Defining the model
    4. Training the model
    5. Defining and training a text-generating model
    6. Generating book scripts
    7. Summary
    8. Questions
  20. 14: Playing Pacman Using Deep Reinforcement Learning
    1. Reinforcement learning
    2. Reinforcement learning versus supervised and unsupervised learning
    3. Components of Reinforcement Learning
    4. OpenAI Gym 
    5. Creating a Pacman game in OpenAI Gym 
    6. DQN for deep reinforcement learning
    7. Applying DQN to a game
    8. Summary
    9. Further Reading
  21. 15: What is Next?
    1. Implementing TensorFlow in production
      1. Understanding TensorFlow Hub
      2. TensorFlow Serving
      3. TensorFlow Extended
    2. Recommendations for building AI applications
    3. Limitations of deep learning
    4. AI applications in industries
    5. Ethical considerations in AI
    6. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think