0%

Book Description

Discover how to leverage Keras, the powerful and easy-to-use open source Python library for developing and evaluating deep learning models

Key Features

  • Get to grips with various model evaluation metrics, including sensitivity, specificity, and AUC scores
  • Explore advanced concepts such as sequential memory and sequential modeling
  • Reinforce your skills with real-world development, screencasts, and knowledge checks

Book Description

New experiences can be intimidating, but not this one! This beginner's guide to deep learning is here to help you explore deep learning from scratch with Keras, and be on your way to training your first ever neural networks.

What sets Keras apart from other deep learning frameworks is its simplicity. With over two hundred thousand users, Keras has a stronger adoption in industry and the research community than any other deep learning framework.

The Deep Learning with Keras Workshop starts by introducing you to the fundamental concepts of machine learning using the scikit-learn package. After learning how to perform the linear transformations that are necessary for building neural networks, you'll build your first neural network with the Keras library. As you advance, you'll learn how to build multi-layer neural networks and recognize when your model is underfitting or overfitting to the training data. With the help of practical exercises, you'll learn to use cross-validation techniques to evaluate your models and then choose the optimal hyperparameters to fine-tune their performance. Finally, you'll explore recurrent neural networks and learn how to train them to predict values in sequential data.

By the end of this book, you'll have developed the skills you need to confidently train your own neural network models.

What you will learn

  • Gain insights into the fundamentals of neural networks
  • Understand the limitations of machine learning and how it differs from deep learning
  • Build image classifiers with convolutional neural networks
  • Evaluate, tweak, and improve your models with techniques such as cross-validation
  • Create prediction models to detect data patterns and make predictions
  • Improve model accuracy with L1, L2, and dropout regularization

Who this book is for

If you know the basics of data science and machine learning and want to get started with advanced machine learning technologies like artificial neural networks and deep learning, then this is the book for you. To grasp the concepts explained in this deep learning book more effectively, prior experience in Python programming and some familiarity with statistics and logistic regression are a must.

Table of Contents

  1. The Deep Learning with Keras Workshop
  2. Preface
    1. About the Book
      1. Audience
      2. About the Chapters
      3. Conventions
      4. Code Presentation
      5. Setting up Your Environment
      6. Installing Anaconda
      7. Installing Libraries
      8. Running Jupyter Notebook
      9. Accessing the Code Files
  3. 1. Introduction to Machine Learning with Keras
    1. Introduction
    2. Data Representation
      1. Tables of Data
      2. Loading Data
      3. Exercise 1.01: Loading a Dataset from the UCI Machine Learning Repository
    3. Data Preprocessing
      1. Exercise 1.02: Cleaning the Data
      2. Appropriate Representation of the Data
      3. Exercise 1.03: Appropriate Representation of the Data
    4. Life Cycle of Model Creation
      1. Machine Learning Libraries
    5. scikit-learn
    6. Keras
      1. Advantages of Keras
      2. Disadvantages of Keras
      3. More Than Building Models
    7. Model Training
      1. Classifiers and Regression Models
      2. Classification Tasks
      3. Regression Tasks
      4. Training Datasets and Test Datasets
      5. Model Evaluation Metrics
      6. Exercise 1.04: Creating a Simple Model
    8. Model Tuning
      1. Baseline Models
      2. Exercise 1.05: Determining a Baseline Model
      3. Regularization
      4. Cross-Validation
      5. Activity 1.01: Adding Regularization to the Model
    9. Summary
  4. 2. Machine Learning versus Deep Learning
    1. Introduction
      1. Advantages of ANNs over Traditional Machine Learning Algorithms
      2. Advantages of Traditional Machine Learning Algorithms over ANNs
      3. Hierarchical Data Representation
    2. Linear Transformations
      1. Scalars, Vectors, Matrices, and Tensors
      2. Tensor Addition
      3. Exercise 2.01: Performing Various Operations with Vectors, Matrices, and Tensors
      4. Reshaping
      5. Matrix Transposition
      6. Exercise 2.02: Matrix Reshaping and Transposition
      7. Matrix Multiplication
      8. Exercise 2.03: Matrix Multiplication
      9. Exercise 2.04: Tensor Multiplication
    3. Introduction to Keras
      1. Layer Types
      2. Activation Functions
      3. Model Fitting
      4. Activity 2.01: Creating a Logistic Regression Model Using Keras
    4. Summary
  5. 3. Deep Learning with Keras
    1. Introduction
    2. Building Your First Neural Network
      1. Logistic Regression to a Deep Neural Network
      2. Activation Functions
      3. Forward Propagation for Making Predictions
      4. Loss Function
      5. Backpropagation for Computing Derivatives of Loss Function
      6. Gradient Descent for Learning Parameters
      7. Exercise 3.01: Neural Network Implementation with Keras
      8. Activity 3.01: Building a Single-Layer Neural Network for Performing Binary Classification
    3. Model Evaluation
      1. Evaluating a Trained Model with Keras
      2. Splitting Data into Training and Test Sets
      3. Underfitting and Overfitting
      4. Early Stopping
      5. Activity 3.02: Advanced Fibrosis Diagnosis with Neural Networks
    4. Summary
  6. 4. Evaluating Your Model with Cross-Validation Using Keras Wrappers
    1. Introduction
    2. Cross-Validation
      1. Drawbacks of Splitting a Dataset Only Once
      2. K-Fold Cross-Validation
      3. Leave-One-Out Cross-Validation
      4. Comparing the K-Fold and LOO Methods
    3. Cross-Validation for Deep Learning Models
      1. Keras Wrapper with scikit-learn
      2. Exercise 4.01: Building the Keras Wrapper with scikit-learn for a Regression Problem
      3. Cross-Validation with scikit-learn
      4. Cross-Validation Iterators in scikit-learn
      5. Exercise 4.02: Evaluating Deep Neural Networks with Cross-Validation
      6. Activity 4.01: Model Evaluation Using Cross-Validation for an Advanced Fibrosis Diagnosis Classifier
    4. Model Selection with Cross-Validation
      1. Cross-Validation for Model Evaluation versus Model Selection
      2. Exercise 4.03: Writing User-Defined Functions to Implement Deep Learning Models with Cross-Validation
      3. Activity 4.02: Model Selection Using Cross-Validation for the Advanced Fibrosis Diagnosis Classifier
      4. Activity 4.03: Model Selection Using Cross-validation on a Traffic Volume Dataset
    5. Summary
  7. 5. Improving Model Accuracy
    1. Introduction
    2. Regularization
      1. The Need for Regularization
      2. Reducing Overfitting with Regularization
    3. L1 and L2 Regularization
      1. L1 and L2 Regularization Formulation
      2. L1 and L2 Regularization Implementation in Keras
      3. Activity 5.01: Weight Regularization on an Avila Pattern Classifier
    4. Dropout Regularization
      1. Principles of Dropout Regularization
      2. Reducing Overfitting with Dropout
      3. Exercise 5.01: Dropout Implementation in Keras
      4. Activity 5.02: Dropout Regularization on the Traffic Volume Dataset
    5. Other Regularization Methods
      1. Early Stopping
      2. Exercise 5.02: Implementing Early Stopping in Keras
      3. Data Augmentation
      4. Adding Noise
    6. Hyperparameter Tuning with scikit-learn
      1. Grid Search with scikit-learn
      2. Randomized Search with scikit-learn
      3. Activity 5.03: Hyperparameter Tuning on the Avila Pattern Classifier
    7. Summary
  8. 6. Model Evaluation
    1. Introduction
    2. Accuracy
      1. Exercise 6.01: Calculating Null Accuracy on a Pacific Hurricanes Dataset
      2. Advantages and Limitations of Accuracy
    3. Imbalanced Datasets
      1. Working with Imbalanced Datasets
    4. Confusion Matrix
      1. Metrics Computed from a Confusion Matrix
      2. Exercise 6.02: Computing Accuracy and Null Accuracy with APS Failure for Scania Trucks Data
      3. Activity 6.01: Computing the Accuracy and Null Accuracy of a Neural Network When We Change the Train/Test Split
      4. Exercise 6.03: Deriving and Computing Metrics Based on a Confusion Matrix
      5. Activity 6.02: Calculating the ROC Curve and AUC Score
    5. Summary
  9. 7. Computer Vision with Convolutional Neural Networks
    1. Introduction
    2. Computer Vision
    3. Convolutional Neural Networks
    4. The Architecture of a CNN
      1. Input Image
      2. Convolution Layer
      3. The Pooling Layer
      4. Flattening
    5. Image Augmentation
      1. Advantages of Image Augmentation
      2. Exercise 7.01: Building a CNN and Identifying Images of Cars and Flowers
      3. Activity 7.01: Amending Our Model with Multiple Layers and the Use of softmax
      4. Exercise 7.02: Amending Our Model by Reverting to the Sigmoid Activation Function
      5. Exercise 7.03: Changing the Optimizer from Adam to SGD
      6. Exercise 7.04: Classifying a New Image
      7. Activity 7.02: Classifying a New Image
    6. Summary
  10. 8. Transfer Learning and Pre-Trained Models
    1. Introduction
    2. Pre-Trained Sets and Transfer Learning
      1. Feature Extraction
    3. Fine-Tuning a Pre-Trained Network
      1. The ImageNet Dataset
      2. Some Pre-Trained Networks in Keras
      3. Exercise 8.01: Identifying an Image Using the VGG16 Network
      4. Activity 8.01: Using the VGG16 Network to Train a Deep Learning Network to Identify Images
      5. Exercise 8.02: Classifying Images That Are Not Present in the ImageNet Database
      6. Exercise 8.03: Fine-Tuning the VGG16 Model
      7. Exercise 8.04: Image Classification with ResNet
      8. Activity 8.02: Image Classification with ResNet
    4. Summary
  11. 9. Sequential Modeling with Recurrent Neural Networks
    1. Introduction
    2. Sequential Memory and Sequential Modeling
    3. Recurrent Neural Networks (RNNs)
      1. The Vanishing Gradient Problem
      2. A Brief Explanation of the Exploding Gradient Problem
    4. Long Short-Term Memory (LSTM)
      1. Exercise 9.01: Predicting the Trend of Alphabet's Stock Price Using an LSTM with 50 Units (Neurons)
      2. Activity 9.01: Predicting the Trend of Amazon's Stock Price Using an LSTM with 50 Units (Neurons)
      3. Exercise 9.02: Predicting the Trend of Alphabet's Stock Price Using an LSTM with 100 units
      4. Activity 9.02: Predicting Amazon's Stock Price with Added Regularization
      5. Activity 9.03: Predicting the Trend of Amazon's Stock Price Using an LSTM with an Increasing Number of LSTM Neurons (100 Units)
    5. Summary
  12. Appendix
    1. 1. Introduction to Machine Learning with Keras
      1. Activity 1.01: Adding Regularization to the Model
    2. 2. Machine Learning versus Deep Learning
      1. Activity 2.01: Creating a Logistic Regression Model Using Keras
    3. 3. Deep Learning with Keras
      1. Activity 3.01: Building a Single-Layer Neural Network for Performing Binary Classification
      2. Activity 3.02: Advanced Fibrosis Diagnosis with Neural Networks
    4. 4. Evaluating Your Model with Cross-Validation Using Keras Wrappers
      1. Activity 4.01: Model Evaluation Using Cross-Validation for an Advanced Fibrosis Diagnosis Classifier
      2. Activity 4.02: Model Selection Using Cross-Validation for the Advanced Fibrosis Diagnosis Classifier
      3. Activity 4.03: Model Selection Using Cross-validation on a Traffic Volume Dataset
    5. 5. Improving Model Accuracy
      1. Activity 5.01: Weight Regularization on an Avila Pattern Classifier
      2. Activity 5.02: Dropout Regularization on the Traffic Volume Dataset
      3. Activity 5.03: Hyperparameter Tuning on the Avila Pattern Classifier
    6. 6. Model Evaluation
      1. Activity 6.01: Computing the Accuracy and Null Accuracy of a Neural Network When We Change the Train/Test Split
      2. Activity 6.02: Calculating the ROC Curve and AUC Score
    7. 7. Computer Vision with Convolutional Neural Networks
      1. Activity 7.01: Amending Our Model with Multiple Layers and the Use of softmax
      2. Activity 7.02: Classifying a New Image
    8. 8. Transfer Learning and Pre-Trained Models
      1. Activity 8.01: Using the VGG16 Network to Train a Deep Learning Network to Identify Images
      2. Activity 8.02: Image Classification with ResNet
    9. 9. Sequential Modeling with Recurrent Neural Networks
      1. Activity 9.01: Predicting the Trend of Amazon's Stock Price Using an LSTM with 50 Units (Neurons)
      2. Activity 9.02: Predicting Amazon's Stock Price with Added Regularization
      3. Activity 9.03: Predicting the Trend of Amazon's Stock Price Using an LSTM with an Increasing Number of LSTM Neurons (100 Units)