Deep Learning For Dummies®
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2019 by John Wiley & Sons, Inc., Hoboken, New Jersey
Media and software compilation copyright © 2019 by John Wiley & Sons, Inc. All rights reserved.
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions
.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit https://hub.wiley.com/community/support/dummies
.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com
. For more information about Wiley products, visit www.wiley.com
.
Library of Congress Control Number is available from the publisher: 2019937505
ISBN 978-1-119-54304-6 (pbk); ISBN 978-1-119-54303-9 (ebk); ISBN ePDF 978-1-119-54302-2 (ebk)
When you talk to some people about deep learning, they think of some deep dark mystery, but deep learning really isn’t a mystery at all — you use it every time you talk to your smartphone, so you have it with you every day. In fact, you find deep learning used everywhere. For example, you see it when using many applications online and even when you shop. You are surrounded by deep learning and don’t even realize it, which makes learning about deep learning essential because you can use it to do so much more than you might think possible.
Other people have another view of deep learning that has no basis in reality. They think that somehow deep learning will be responsible for some dire apocalypse, but that really isn’t possible with today’s technology. More likely is that someone will find a way to use deep learning to create fake people in order to commit crimes or to bilk the government out of thousands of dollars. However, killer robots are most definitely not part of the future.
Whether you’re part of the mystified crowd or the killer robot crowd, we hope that you’ll read Deep Learning For Dummies with the goal of understanding what deep learning can actually do. This technology can probably do a lot more in the way of mundane tasks than you think possible, but it also has limits, and you need to know about both.
When you work through Deep Learning For Dummies, you gain access to a lot of example code that will run on a standard Mac, Linux, or Windows system. You can also run the code online using something like Google Colab. (We provide pointers on how to get the information you need to do this.) Special equipment, such as a GPU, will make the examples run faster. However, the point of this book is that you can create deep learning code no matter what sort of machine you have as long as you’re willing to wait for some of it to complete. (We tell you which examples take a long time to run.)
The first part of this book gives you some starter information so that you don’t get completely lost before you start. You discover how to install the various products you need and gain an understanding of some essential math. The beginning examples are more along the lines of standard regression and machine learning, but you need this basis to gain a full appreciation of just what deep learning can do for you.
After you get past these initial bits of information, you start to do some pretty amazing things. For example, you discover how to generate your own art and perform other tasks that you might have assumed to require many of coding and some special hardware to accomplish. By the end of the book, you’ll be amazed by what you can do, even if you don’t have an advanced machine learning or deep learning degree.
To make absorbing the concepts even easier, this book uses the following conventions:
monofont
. If you're reading a digital version of this book on a device connected to the Internet, you can click or tap the web address to visit that website, like this: http://www.dummies.com
.You might find it difficult to believe that we’ve assumed anything about you — after all, we haven’t even met you yet! Although most assumptions are indeed foolish, we made these assumptions to provide a starting point for the book.
You need to be familiar with the platform you want to use because the book doesn’t offer any guidance in this regard. (Chapter 3 does, however, provide Anaconda installation instructions, and Chapter 4 helps you install the TensorFlow and Keras frameworks used for this book.) To give you the maximum information about Python concerning how it applies to deep learning, this book doesn’t discuss any platform-specific issues. You really do need to know how to install applications, use applications, and generally work with your chosen platform before you begin working with this book.
You must know how to work with Python. You can find a wealth of tutorials online (see https://www.w3schools.com/python/
and https://www.tutorialspoint.com/python/
as examples).
This book isn’t a math primer. Yes, you see many examples of complex math, but the emphasis is on helping you use Python to perform deep learning tasks rather than teaching math theory. We include some examples that also discuss the use of machine learning as it applies to deep learning. Chapters 1 and 2 give you a better understanding of precisely what you need to know to use this book successfully.
This book also assumes that you can access items on the Internet. Sprinkled throughout are numerous references to online material that will enhance your learning experience. However, these added sources are useful only if you actually find and use them.
As you read this book, you see icons in the margins that indicate material of interest (or not, as the case may be).This section briefly describes each icon in this book.
This book isn’t the end of your Python or deep learning experience — it’s really just the beginning. We provide online content to make this book more flexible and better able to meet your needs. That way, as we receive e-mail from you, we can address questions and tell you how updates to either Python or its associated add-ons affect book content. In fact, you gain access to all these cool additions:
www.dummies.com
, searching this book's title, and scrolling down the page that appears. The cheat sheet contains really neat information such as the most common programming mistakes that cause people woe when using Python.Updates: Sometimes changes happen. For example, we might not have seen an upcoming change when we looked into our crystal ball during the writing of this book. In the past, this possibility simply meant that the book became outdated and less useful, but you can now find updates to the book by searching this book's title at www.dummies.com
.
In addition to these updates, check out the blog posts with answers to reader questions and demonstrations of useful book-related techniques at http://blog.johnmuellerbooks.com/
.
www.dummies.com
. Search this book's title, and on the page that appears, scroll down to the image of the book cover and click it. Then click the More about This Book button and on the page that opens, go to the Downloads tab.It’s time to start your Python for deep learning adventure! If you’re completely new to Python and its use for deep learning tasks, you should start with Chapter 1 and progress through the book at a pace that allows you to absorb as much of the material as possible.
If you’re a novice who’s in an absolute rush to get going with Python for deep learning as quickly as possible, you can skip to Chapter 3 with the understanding that you may find some topics a bit confusing later. Skipping to Chapter 4 is okay if you already have Anaconda (the programming product used in the book) installed, but be sure to at least skim Chapter 3 so that you know what assumptions we made when writing this book.
This book relies on a combination of TensorFlow and Keras to perform deep learning tasks. Even if you’re an advanced reader, you need to go to Chapter 4 to discover how to configure the environment used for this book. Failure to configure the environment according to instructions will almost certainly cause failures when you try to run the code.
Part 1
IN THIS PART …
Understand how deep learning impacts the world around us.
Consider the relationship between deep learning and machine learning.
Create a Python setup of your own.
Define the need for a framework in deep learning.