Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Deep Learning By Example
Deep Learning By Example

Deep Learning By Example: A hands-on guide to implementing advanced machine learning algorithms and neural networks

eBook
Can$44.99
Paperback
Can$55.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Deep Learning By Example

Data Modeling in Action - The Titanic Example

Linear models are the basic learning algorithms in the field of data science. Understanding how a linear model works is crucial in your journey of learning data science because it's the basic building block for most of the sophisticated learning algorithms out there, including neural networks.

In this chapter, we are going to dive into a famous problem in the field of data science, which is the Titanic example. The purpose of this example is to introduce linear models for classification and see a full machine learning system pipeline, starting from data handling and exploration up to model evaluation. We are going to cover the following topics in this chapter:

  • Linear models for regression
  • Linear models for classification
  • Titanic example—model building and training
  • Different types of errors
...

Linear models for regression

Linear regression models are the most basic type of regression models and are widely used in predictive data analysis. The overall idea of regression models is to examine two things:

  1. Does a set of explanatory features / input variables do a good job at predicting an output variable? Is the model using features that account for the variability in changes to the dependent variable (output variable)?
  2. Which features in particular are significant ones of the dependent variable? And in what way do they impact the dependent variable (indicated by the magnitude and sign of the parameters)? These regression parameters are used to explain the relationship between one output variable (dependent variable) and one or more input features (independent variables).

A regression equation will formulate the impact of the input variables (independent variables) on the...

Linear models for classification

In this section, we are going to go through logistic regression, which is one of the widely used algorithms for classification.

What's logistic regression? The simple definition of logistic regression is that it's a type of classification algorithm involving a linear discriminant.

We are going to clarify this definition in two points:

  1. Unlike linear regression, logistic regression doesn't try to estimate/predict the value of the numeric variable given a set of features or input variables. Instead, the output of the logistic regression algorithm is the probability that the given sample/observation belongs to a specific class. In simpler words, let's assume that we have a binary classification problem. In this type of problem, we have only two classes in the output variable, for example, diseased or not diseased. So, the probability...

Titanic example – model building and training

The sinking of the ship, Titanic, is one of the most infamous events in history. This incident led to the deaths of 1,502 passengers and crew out of 2,224. In this problem, we will use data science to predict whether the passenger will survive this tragedy or not and then test the performance of our model based on the actual statistics of the tragedy.

To follow up with the Titanic example, you need to do the following:

  1. Download this repository in a ZIP file by clicking on https://github.com/ahmed-menshawy/ML_Titanic/archive/master.zip or execute from the terminal:
  2. Git clone: https://github.com/ahmed-menshawy/ML_Titanic.git
  3. Install [virtualenv]: (http://virtualenv.readthedocs.org/en/latest/installation.html)
  4. Navigate to the directory where you unzipped or cloned the repo and create a virtual environment with virtualenv ml_titanic...

Different types of errors

In machine learning, there are two types of errors, and as a newcomer to data science, you need to understand the crucial difference between both of them. If you end up minimizing the wrong type of error, the whole learning system will be useless and you won’t be able to use it in practice over unseen data. To minimize this kind of misunderstanding between practitioners about these two types of errors, we are going to explain them in the following two sections.

Apparent (training set) error

This the first type of error that you don't have to care about minimizing. Getting a small value for this type of error doesn't mean that your model will work well over the unseen data (generalize). To better understand this type of error, we'll give a trivial example of a class scenario. The purpose of solving problems in the classroom is not to be able to solve the same problem again in the exam, but to be able to solve other problems that won’t necessarily be similar to the ones you practiced in the classroom. The exam problems could be from the same family of the classroom problems, but not necessarily identical.

Apparent error is the ability of the trained model to perform on the training set for which we already know the true outcome/output. If you manage to get 0 error over the training set, then it is a good indicator...

Generalization/true error

This is the second and more important type of error in data science. The whole purpose of building learning systems is the ability to get a smaller generalization error on the test set; in other words, to get the model to work well on a set of observation/samples that haven't been used in the training phase. If you still consider the class scenario from the previous section, you can think of generalization error as the ability to solve exam problems that weren’t necessarily similar to the problems you solved in the classroom to learn and get familiar with the subject. So, generalization performance is the model's ability to use the skills (parameters) that it learned in the training phase in order to correctly predict the outcome/output of unseen data.

In Figure 13, the light blue line represents the generalization error. You can see...

Summary

A linear model is a very powerful tool that you can use as an initial learning algorithm if your data matches its assumptions. Understanding linear models will help you to understand more sophisticated models that use linear models as building blocks.

Next up, we will continue using the Titanic example by addressing model complexity and assessment in more detail. Model complexity is a very powerful tool and you need to use it carefully in order to enhance the generalization error. Misunderstanding it will lead to overfitting problems.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get a first-hand experience of the deep learning concepts and techniques with this easy-to-follow guide
  • Train different types of neural networks using Tensorflow for real-world problems in language processing, computer vision, transfer learning, and more
  • Designed for those who believe in the concept of 'learn by doing', this book is a perfect blend of theory and code examples

Description

Deep learning is a popular subset of machine learning, and it allows you to build complex models that are faster and give more accurate predictions. This book is your companion to take your first steps into the world of deep learning, with hands-on examples to boost your understanding of the topic. This book starts with a quick overview of the essential concepts of data science and machine learning which are required to get started with deep learning. It introduces you to Tensorflow, the most widely used machine learning library for training deep learning models. You will then work on your first deep learning problem by training a deep feed-forward neural network for digit classification, and move on to tackle other real-world problems in computer vision, language processing, sentiment analysis, and more. Advanced deep learning models such as generative adversarial networks and their applications are also covered in this book. By the end of this book, you will have a solid understanding of all the essential concepts in deep learning. With the help of the examples and code provided in this book, you will be equipped to train your own deep learning models with more confidence.

Who is this book for?

This book targets data scientists and machine learning developers who wish to get started with deep learning. If you know what deep learning is but are not quite sure of how to use it, this book will help you as well. An understanding of statistics and data science concepts is required. Some familiarity with Python programming will also be beneficial.

What you will learn

  • Understand the fundamentals of deep learning and how it is different from machine learning
  • Get familiarized with Tensorflow, one of the most popular libraries for advanced machine learning
  • Increase the predictive power of your model using feature engineering
  • Understand the basics of deep learning by solving a digit classification problem of MNIST
  • Demonstrate face generation based on the CelebA database, a promising application of generative models
  • Apply deep learning to other domains like language modeling, sentiment analysis, and machine translation

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 28, 2018
Length: 450 pages
Edition : 1st
Language : English
ISBN-13 : 9781788395762
Category :
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Feb 28, 2018
Length: 450 pages
Edition : 1st
Language : English
ISBN-13 : 9781788395762
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 161.97
Deep Learning By Example
Can$55.99
Deep Learning Quick Reference
Can$55.99
Practical Convolutional Neural Networks
Can$49.99
Total Can$ 161.97 Stars icon

Table of Contents

17 Chapters
Data Science - A Birds' Eye View Chevron down icon Chevron up icon
Data Modeling in Action - The Titanic Example Chevron down icon Chevron up icon
Feature Engineering and Model Complexity – The Titanic Example Revisited Chevron down icon Chevron up icon
Get Up and Running with TensorFlow Chevron down icon Chevron up icon
TensorFlow in Action - Some Basic Examples Chevron down icon Chevron up icon
Deep Feed-forward Neural Networks - Implementing Digit Classification Chevron down icon Chevron up icon
Introduction to Convolutional Neural Networks Chevron down icon Chevron up icon
Object Detection – CIFAR-10 Example Chevron down icon Chevron up icon
Object Detection – Transfer Learning with CNNs Chevron down icon Chevron up icon
Recurrent-Type Neural Networks - Language Modeling Chevron down icon Chevron up icon
Representation Learning - Implementing Word Embeddings Chevron down icon Chevron up icon
Neural Sentiment Analysis Chevron down icon Chevron up icon
Autoencoders – Feature Extraction and Denoising Chevron down icon Chevron up icon
Generative Adversarial Networks Chevron down icon Chevron up icon
Face Generation and Handling Missing Labels Chevron down icon Chevron up icon
Implementing Fish Recognition Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.3
(3 Ratings)
5 star 33.3%
4 star 0%
3 star 0%
2 star 0%
1 star 66.7%
Lifeng Han Apr 02, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book has a very large coverage of content and knowledge. It covers the Data Modeling, Feature Engineering and Model Complexity, currently popular DL toolkit TensorFlow with examples, and different kinds of Neural Nets such as Feed-forward NN/CNN/GAN with some application introduction like classification task, sentiment analysis and face generation. It also introduces transfer learning and representation learning.I do believe the audiences will benefit from this advanced machine learning book with examples.
Amazon Verified review Amazon
Tom Francart Jul 17, 2018
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
While I was really looking forward to reading this book, I'm disappointed on two fronts:1. Typesetting: I normally wouldn't even mention this, but it's really bad. There are a lot of code examples, which are made very hard to read by improper line wrapping. Also, there is no syntax highlighting, which would have been helpful. In addition, the formulas look terrible: the font is not matched with the remainder of the text and the resolution is low.In addition, the figures are printed in black and white, but are not legible in black and white, for instance the text refers to "blue" and "red".On the whole, this book looks as if someone quickly converted it from another format and didn't even bother to look at the end result. This is unacceptable for a book produced by a supposedly professional company.2. Content: the references are unscientific; wikipedia and random websites are not reliable sources of information, especially for definitions that are essential to the book.Another disappointment is that the author describes how a certain DNN can be implemented in Tensorflow, but he does not explain how this DNN (in particular the hyperparameters) was obtained. I was hoping to learn by example how to find a good architecture and optimise the parameters, which is the hard part of deep learning.
Amazon Verified review Amazon
Tom Francart Jul 17, 2018
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
While I was really looking forward to reading this book, I'm disappointed on two fronts:1. Typesetting: I normally wouldn't even mention this, but it's really bad. There are a lot of code examples, which are made very hard to read by improper line wrapping. Also, there is no syntax highlighting, which would have been helpful. In addition, the formulas look terrible: the font is not matched with the remainder of the text and the resolution is low.In addition, the figures are printed in black and white, but are not legible in black and white, for instance the text refers to "blue" and "red".On the whole, this book looks as if someone quickly converted it from another format and didn't even bother to look at the end result. This is unacceptable for a book produced by a supposedly professional company.2. Content: the references are unscientific; wikipedia and random websites are not reliable sources of information, especially for definitions that are essential to the book.Another disappointment is that the author describes how a certain DNN can be implemented in Tensorflow, but he does not explain how this DNN (in particular the hyperparameters) was obtained. I was hoping to learn by example how to find a good architecture and optimise the parameters, which is the hard part of deep learning.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.