Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
The Deep Learning with Keras Workshop
The Deep Learning with Keras Workshop

The Deep Learning with Keras Workshop: Learn how to define and train neural network models with just a few lines of code

Arrow left icon
Profile Icon Matthew Moocarme Profile Icon Mahla Abdolahnejad Profile Icon Ritesh Bhagwat
Arrow right icon
NZ$31.99 NZ$45.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (8 Ratings)
eBook Jul 2020 496 pages 1st Edition
eBook
NZ$31.99 NZ$45.99
Paperback
NZ$56.99
Subscription
Free Trial
Arrow left icon
Profile Icon Matthew Moocarme Profile Icon Mahla Abdolahnejad Profile Icon Ritesh Bhagwat
Arrow right icon
NZ$31.99 NZ$45.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (8 Ratings)
eBook Jul 2020 496 pages 1st Edition
eBook
NZ$31.99 NZ$45.99
Paperback
NZ$56.99
Subscription
Free Trial
eBook
NZ$31.99 NZ$45.99
Paperback
NZ$56.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
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

The Deep Learning with Keras Workshop

2. Machine Learning versus Deep Learning

Overview

In this chapter, we will begin creating Artificial Neural Networks (ANNs) using the Keras library. Before utilizing the library for modeling, we will get an introduction to the mathematics that comprise ANNs—understanding linear transformations and how they can be applied in Python. You'll build a firm grasp of the mathematics that make up ANNs. By the end of this chapter, we will have applied that knowledge by building a logistic regression model with Keras.

Introduction

In the previous chapter, we discussed some applications of machine learning and even built models with the scikit-learn Python package. The previous chapter covered how to preprocess real-world datasets so that they can be used for modeling. To do this, we converted all the variables into numerical data types and converted categorical variables into dummy variables. We used the logistic regression algorithm to classify users of a website by their purchase intention from the online shoppers purchasing intention dataset. We advanced our model-building skills by adding regularization to the dataset to improve the performance of our models.

In this chapter, we will continue learning how to build machine learning models and extend our knowledge so that we can build an Artificial Neural Network (ANN) with the Keras package. (Remember that ANNs represent a large class of machine learning algorithms that are so-called because their architecture resembles the neurons in the...

Linear Transformations

In this section, we will introduce linear transformations. Linear transformations are the backbone of modeling with ANNs. In fact, all the processes of ANN modeling can be thought of as a series of linear transformations. The working components of linear transformations are scalars, vectors, matrices, and tensors. Operations such as addition, transposition, and multiplication are performed on these components.

Scalars, Vectors, Matrices, and Tensors

Scalars, vectors, matrices, and tensors are the actual components of any deep learning model. Having a fundamental understanding of how to utilize these components, as well as the operations that can be performed on them, is key to understanding how ANNs operate. Scalars, vectors, and matrices are examples of the general entity known as a tensor, so the term tensors may be used throughout this chapter but may refer to any component. Scalars, vectors, and matrices refer to tensors with a specific number...

Introduction to Keras

Building ANNs involves creating layers of nodes. Each node can be thought of as a tensor of weights that are learned in the training process. Once the ANN has been fitted to the data, a prediction is made by multiplying the input data by the weight matrices layer by layer, applying any other linear transformation when needed, such as activation functions, until the final output layer is reached. The size of each weight tensor is determined by the size of the shape of the input nodes and the shape of the output nodes. For example, in a single-layer ANN, the size of our single hidden layer can be thought of as follows:

Figure 2.16: Solving the dimensions of the hidden layer of a single-layer ANN

If the input matrix of features has n rows, or observations, and m columns, or features, and we want our predicted target to have n rows (one for each observation) and one column (the predicted value), we can determine the size of our hidden layer...

Summary

In this chapter, we covered the various types of linear algebra components and operations that pertain to machine learning. These components include scalars, vectors, matrices, and tensors. The operations that were applied to these tensors included addition, transposition, and multiplication—all of which are fundamental for understanding the underlying mathematics of ANNs.

We also learned some of the basics of the Keras package, including the mathematics that occurs at each node. We replicated the model from the previous chapter, in which we built a logistic regression model to predict the same target from the online shopping purchasing intention dataset. However, in this chapter, we used the Keras library to create the model using an ANN instead of the scikit-learn logistic regression model. We achieved a similar level of accuracy using ANNs.

The upcoming chapters of this book will use the same concepts we learned about in this chapter; however, we will continue...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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

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.

Who is this book 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.

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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 29, 2020
Length: 496 pages
Edition : 1st
Language : English
ISBN-13 : 9781800564756
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 feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Jul 29, 2020
Length: 496 pages
Edition : 1st
Language : English
ISBN-13 : 9781800564756
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 NZ$7 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 NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 178.97
The Deep Learning Workshop
NZ$64.99
The Deep Learning with Keras Workshop
NZ$56.99
The Deep Learning with PyTorch Workshop
NZ$56.99
Total NZ$ 178.97 Stars icon

Table of Contents

9 Chapters
1. Introduction to Machine Learning with Keras Chevron down icon Chevron up icon
2. Machine Learning versus Deep Learning Chevron down icon Chevron up icon
3. Deep Learning with Keras Chevron down icon Chevron up icon
4. Evaluating Your Model with Cross-Validation Using Keras Wrappers Chevron down icon Chevron up icon
5. Improving Model Accuracy Chevron down icon Chevron up icon
6. Model Evaluation Chevron down icon Chevron up icon
7. Computer Vision with Convolutional Neural Networks Chevron down icon Chevron up icon
8. Transfer Learning and Pre-Trained Models Chevron down icon Chevron up icon
9. Sequential Modeling with Recurrent Neural Networks Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(8 Ratings)
5 star 62.5%
4 star 37.5%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Darwin Cubi Jan 27, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
En mi caso me interesó este libro pues la mayoría del tiempo trabajo con R y he estado poco a poco aprendiendo python, con principal intereses en el aprendizaje profundo. No he tenido la oportunidad de trabajar con keras o tensorFlow y tengo que decir que me sentí algo intimidado cuando mire los ejemplos que se encuentran que la web del desarrollador. Este libro en apariencia es extenso con sus 495 páginas y 9 capítulos pero se debe a que tiene varias ilustraciones, bloques de código junto con el detalle de las funciones. Desde el primer capítulo hasta el último se definen y aclaran conceptos de manera muy sencilla sin entrar en detalles matemáticos, si ya tienes cierta experiencia podrías saltarte el capítulo 1. Lo genial del libro es que hace una perfecta sincronía entre mostrar los pasos que se deben seguir para la elaboración de un modelo y cómo usar las bibliotecas keras y tensorflow. Además el libro está estructurado de tal manera que todo el desarrollo y aprendizaje de un capitulo se usa para el capítulo siguiente.Todo el código que se muestra en el libro ya se encuentra en github junto con el archivo requirements.txt que facilita mucho la instalación de las bibliotecas necesarias. Recomiendo mucho este libro a personas que tengan poca o nada de experiencia en el desarrollo de modelos ya que hará que su primer contacto sea muy fácil y muy enriquecedor en conceptos y buenas prácticas al momento de crear un modelo de aprendizaje profundo. No lo recomendaría para personas con experiencia que buscan el concepto matemático o que desean profundizar en la optimización o uso de los hyperparametros de un modelo.In my case I was interested in this book as most of the time I work with R and have been slowly learning python, with main interests in deep learning. I have not had the opportunity to work with keras or tensorFlow and I have to say that I felt a bit intimidated when I looked at the examples found on the developer's website. This book in appearance is lengthy with its 495 pages and 9 chapters but that is because it has several illustrations, code blocks along with the detail of the functions. From the first chapter to the last it defines and clarifies concepts in a very simple way without going into mathematical details, if you already have some experience you could skip chapter 1. The great thing about the book is that it makes a perfect synchrony between showing the steps that must be followed for the development of a model and how to use the keras and tensorflow libraries. Also the book is structured in such a way that all the development and learning from one chapter is used for the next chapter.All the code shown in the book is already on github along with the requirements.txt file which makes it much easier to install the necessary libraries. I highly recommend this book to people with little or no experience in model development as it will make your first contact very easy and very enriching in concepts and best practices when creating a deep learning model. I would not recommend it for experienced people who are looking for the mathematical concept or who want to go deeper into the optimization or use of the hyperparameters of a model.
Amazon Verified review Amazon
Sree Feb 11, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
One of the best books on Keras!
Amazon Verified review Amazon
Andrew Dec 13, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great book if you want to learn how to use Keras for deep learning! The layout is clear and easily understandable, with lots of practical applications with code examples. The book is well organized into chapters that make it a practical resource. Practical aspects such as data preprocessing, model evaluation and advantages/disadvantages of deep learning are also covered, which make this a good reference for both how deep learning models work as well as how they can be best applied. Highly recommended for anyone looking to start using Keras for their machine learning projects!
Amazon Verified review Amazon
Siim Tolk Feb 28, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The authors do not assume any prior knowledge from the reader except for some experience with Python and Linear Algebra. However, the chapters manage to avoid lengthy introductory theory and cover the necessary basics quickly which means that you’ll see how to actually use the packages on example problems in no time. The book relies heavily on examples, which keeps the pace high, and offers explanations on what is going on behind the scenes along the way.All in all, I think it is an excellent resource for people new to the field.Best read with a Jupyter notebook running on aside.(FYI, I was sent a copy of the book by the authors for an unbiased review )
Amazon Verified review Amazon
Martin Alonso Jan 11, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I’ve always found neural networks and deep learning fascinating. The ease with which they can be used to solve any machine learning problem are mind-blowing, though their computational power varies with the number of neurons you decide to use, which can be either a hindrance or a boon to the model.The advantage of having open-source platforms, such as Python, Jupyter, and the several libraries and modules available is there is always a software developer who has already tried to solve the problem you are working on. Thus, the likelihood that there is a Python library capable of implementing machine learning or deep learning models was already pretty high. Enter Tensorflow and Keras.Both these libraries work together, and they are very easy to implement straight out of the box – once you’ve installed the necessary dependencies that enable their use. And though the tutorials on their website are straightforward, there is very little documentation on how to apply neural networks beyond what is offered on the website, which is simple regression and image classification problems.The Deep Learning with Keras Workshop aims to correct this.It is a very easy to follow guide which strives to lay the groundwork behind how neural networks work and how these could be applied using Keras. It does so by assuming that the user isn’t wanting in statistical analysis or how modeling works, but by first explaining the proper way the data should be assessed, establishing a baseline using both the data itself and a simple model, and from there building up on how neural networks work.When it comes to how models are built, evaluated, and tuned, it is very easy to find tutorials that cover all this; albeit these can be very brief, not explaining the intricacies of the model, while also being very crowded when it comes to explaining how each part of the model-building process comes together. I thoroughly enjoyed that, in this book, while each of these parts is studied, they are each dedicated a separate chapter, allowing the reader to take their time to explained how concepts such as hyperparameter tuning or cross-validation are used to boost the model’s prediction capabilities. By not cramming model building, tuning, evaluation, and cross-validation into every single chapter, but rather presenting each one individually and using the previous as a foundation to build on the next, the authors have done an extremely good job building a book that genuinely teaches not only how Keras works, but how the process of building any model works.Turning to the user examples, each chapter builds on the previous one, allowing the user to build more robust models, but not all chapters use the same examples. I found it refreshing that the book works with several real-world problems and data sets, showing the user how neural networks and Keras can be applied to several problems. And, though not all of them have high accuracy rates or low-test errors, which is not a downside given this is how most real-world problems work, it helps the user by showing the applications of neural networks beyond simple regressions and image classification.The one true downside to this book is that it does not go into detail how each parameter affects the model. Why is it important to have more (or less) epochs or batches? What is the difference between an “adam” and “sgd” optimizer? What is the difference between using Dense(1, activation=’sigmoid’) and Activation(‘sigmoid’)? Nevertheless, going into these details could make the book harder to understand and could cause the user to lose interest, so perhaps adding some minor details, or pointing to further material that can go in depth into those subjects, akin to what is done with the Keras and Tensorflow package websites, would be helpful.Overall, I find that my experience with Keras and neural networks has improved upon reading this book, and though the use of such is computationally demanding, I find that I can now try to use small deep learning models as part of my model evaluation and comparison when exploring new data sets in a more comfortable manner.
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.