# Deep Learning With Python

## Tap The Power of TensorFlow and Theano with Keras,

Develop Your First Model, Achieve State-Of-The-Art Results

Deep learning is the most interesting and powerful machine learning technique right now.

Top deep learning libraries are available on the Python ecosystem like Theano and TensorFlow. Tap into their power in a few lines of code using Keras, the best-of-breed applied deep learning library.

In this mega Ebook is written in the friendly Machine Learning Mastery style that you’re used to, learn exactly how to get started and apply deep learning to your own machine learning projects. After purchasing you will get:

- 256 Page PDF Ebook.
- 66 Python Recipes.
- 18 Step-by-Step Lessons.
- 9 End-to-End Projects.

#### Finally, Bring Deep Learning To Your Projects

Convinced?

Click to jump straight to the packages.

## Why Are Deep Learning Models So Powerful?

…the secret is “Representation Learning“

…the secret is “Representation Learning“

Deep learning techniques are so powerful because they learn the best way to represent the problem while learning how to solve the problem.

This is called representation learning.

Representation learning is perhaps the biggest differentiation between deep learning models and classical machine learning algorithm.

It is the power of representation learning that is spurring such great creativity in the way the techniques are being used. For example:

- Deep learning models are being used for very difficult problems and making progress, like colorizing image and videos based on the context in the scene.
- Deep learning models are being used in bold new ways, such as cutting the head off a network trained on one problem and tuning it for a completely different problem, and getting impressive results.
- Combinations of deep learning models are being used to both identify objects in photographs and then generate textual descriptions of those objects, a complex multi-media problem that was previously thought to require large artificial intelligence systems.

Deep learning is hot, it is delivering results and now is the time to get involved. But where do you start?

## So How Do Regular People Get Started?

*…don’t do what everyone else does!*

Where do you even begin in deep learning?

Deep learning looks like a hard field to get started in.

And in many ways it is hard to get started. Hard enough that many people try and quickly give up.

Why?

Because they are told that they must already be masters in a laundry list of academic disciplines.

**Here’s The WRONG WAY To Get Started in Deep Learning**

For example, a common response to the question “*how do I get started in deep learning*” might be:

- Develop a strong grounding in statistics, probability, linear algebra, multivariate statistics and calculus.
- Develop a deep knowledge of modern machine learning algorithms and techniques.
- Study and become one with the mathematical theory of each deep learning algorithm and a bunch of related techniques for using them.
- Oh and if there is time find a library and start applying deep learning to your problem.

It could take a decade or more to follow this advice and that would be a decade delay that you cannot afford.

### This approach is DEAD WRONG

If I had followed the advice given to beginner developers (study discrete math, start with assembler, etc.) I would never have started developing software as a profession.

Don’t let this same “** first principles fallacy**” stop you from following your growing interest and passion in deep learning.

There is a much easier path that is just right for you. Flip the script.

**Deep Learning For The Rest Of Us**

*…so here is how to do it*

*…so here is how to do it*

Deep learning is a tool that you can use on your machine learning projects. It does not have to be a theoretical academic pursuit that you study in gritty detail.

You can get started in deep learning by selecting one of the best-of-breed deep learning libraries and start developing models.

You will not understand all of the internals to begin with, but you will very quickly learn how to develop and evaluate deep learning models for a variety of machine learning problems. And **Start delivering value**. Oh and as you may suspect, you probably don’t ever need to understand all of the internals to get excellent results.

The best kept secret of deep learning (and even broader machine learning) is that **the applied side is quite shallow**. It does not take you long to be able to start using the tools quite expertly on your own projects.

The caveat is that you need to bring some rigor in terms of process to ensure that you results are robust (e.g. careful test harness design) and that your solutions are suitable for the problems you are solving (e.g. careful framing of the problem).

So what are the best-of-breed libraries for deep learning?

## Use Python, Build On Top of Theano and TensorFlow

*…and boost your progress 1000% by using Keras*

Develop and evaluate deep learning models in Python.

The platform for getting started in applied deep learning is Python.

Python is a fully featured general purpose programming language, unlike R and Matlab. It is also quick and easy to write and understand, unlike C++ and Java.

The SciPy stack in Python is a mature and quickly expanding platform for scientific and numerical computing. The platform hosts libraries such as scikit-learn the general purpose machine learning library that can be used with your deep learning models.

It is because of these benefits of the Python ecosystem that two top numerical libraries for deep learning were developed for Python, Theano and the newer TensorFlow library released by Google (and adopted recently by the Google DeepMind research group).

Theano and TensorFlow are two top numerical libraries for developing deep learning models, but are too technical and complex for the average practitioner. They are intended more for research and development teams and academics interested in developing wholly new deep learning algorithms.

**The saving grace is the Keras library for deep learning**, that is written in pure Python, wraps and provides a consistent agnostic interface to Theano and TensorFlow and is aimed at machine learning practitioners that are interested in creating and evaluating deep learning models.

It is a little over one year old and is clearly the best-of-breed library for getting started with deep learning because of both the speed at which you can develop models and the numerical power it is built upon.

## Learn Fast By Building Deep Learning Models For Well Understood Problems

*…and build up a library of scripts you can leverage*

The fastest way to get a handle on deep learning and get productive at developing models for your own machine learning problems is to practice.

You can use a tutorial-based approach to learn the basics of different neural network models and feel out the features of the Keras API.

Very quickly you can start to pull together this knowledge and take on larger, fuller and more complicated deep learning projects.

This approach is fast and effective for three reasons:

- You are actually writing code and developing deep learning models rather then reading about it or studying theory.
- Each completed small project provides a working base for further investigation or pivoting into a new problem.
- You amass a catalog of working code for deep learning models and library API that you can dip into and pull together on new projects very quickly.

This is the approach that you can use to rapidly get up-to-speed with applied deep learning in Python with the Keras library and start tackling your own predictive modeling problems with deep learning.

It is also the approach that you can follow in my new ebook **Deep Learning With Python**.

## Introducing “Deep Learning With Python”

*…your ticket to applied deep learning*

This book was designed using for you as a developer to rapidly get up to speed with applied deep learning in Python using the best-of-breed library Keras.

The ebook is comprised of lessons and projects and uses a step-by-step tutorial approach throughout.

The goal is to get you using Keras to quickly create your first neural networks as quickly as possible, then guide you through the finer points of developing deeper models and models for computer vision and natural language problems.

This ebook is your guide to developing and evaluating deep learning models in your own machine learning projects.

Let’s take a closer look at the breakdown of what you will discover inside this ebook.

## Everything You Need To Know to Develop Deep Learning Models in Python

### You Will Get:

18 Lessons on Deep Learning, Keras and More

9 Project Tutorials that Tie it All Together

This ebook was written around two themes designed to get you started and using deep learning effectively and quickly.

These two parts are Lessons and Projects:

**Lessons**: Learn how the sub-tasks of applied deep learning map onto the Keras Python library and the best practice way of working through each task.**Projects**: Tie together all of the knowledge from the lessons by working through case study predictive modeling problems.

### 1. Lessons

Here is an overview of the step-by-step lessons you will complete:

**Lesson 01**: Introduction to the Theano library.**Lesson 02**: Introduction to the TensorFlow library.**Lesson 03**: Introduction to the Keras library.**Lesson 04**: Crash Course in Multi-Layer Perceptrons.**Lesson 05**: Develop Your First Neural Network With Keras.**Lesson 06**: Evaluate the Performance Of Deep Learning Models.**Lesson 07**: Use Keras Models With scikit-learn.**Lesson 08**: Save Your Models For Later With Serialization.**Lesson 09**: Keep The Best Models During Training.**Lesson 10**: Understand Model Behavior During Training.**Lesson 11**: Reduce Overfitting With Dropout Regularization.**Lesson 12**: Lift Performance With Learning Rate Schedules.**Lesson 13**: Crash Course in Convolutional Neural Networks.**Lesson 14**: Improve Model Performance With Image Augmentation.**Lesson 15**: Crash Course in Recurrent Neural Networks.**Lesson 16**: Time Series Prediction with Multilayer Perceptrons.**Lesson 17**: Time Series Prediction with LSTM Networks.**Lesson 18**: Understanding Stateful LSTM Recurrent Neural Networks.

Each lesson was designed to be completed in about 30 minutes by the average developer.

### 2. Projects

Here is an overview of the 7 end-to-end projects you will complete:

**Project 01**: Develop Large Models on GPUs Cheaply in the Cloud.**Project 02**: Multiclass Classification of Flower Species.**Project 03**: Binary Classification of Sonar Returns.**Project 04**: Regression of Boston House Prices.**Project 05**: Handwritten Digit Recognition.**Project 06**: Object Recognition in Photographs.**Project 07**: Predict Sentiment From Movie Reviews.**Project 08**: Sequence Classification with LSTMs for Movie Reviews.**Project 09**: Text Generation With Alice in Wonderland.

Each project was designed to be completed in about 60 minutes by the average developer.

## Here’s Everything You’ll Get…

in *Deep Learning With Python*

### Hands-On Tutorials and Projects

**A digital download that contains everything you need, including:**

- Clear algorithm descriptions that help you to
**understand the principles**that underlie each technique. - Step-by-step deep learning tutorials to show you exactly
**how to apply each method**. - End-to-end deep learning projects that show you exactly how to
**tie the pieces together**and get a result. - Python source code
**recipes for every example**in the book so that you can run the tutorial and project code in seconds. - Digital Ebook in PDF format so that you can have the book open side-by-side with the code and see
**exactly how each example works**.

**Resources you need to go deeper, when you need to, including:**

- Top machine learning textbooks to deepen your foundation of artificial neural networks and deep learning,
**if you crave more**. - The best places online where you can ask your challenging questions and
**actually get a response**.

**Foundations and grounding you need for applied deep learning, including:**

- The
**high-performance computing platform**that underlies deep learning in Python called Theano. - The second optional framework that underlies deep learning in Python called
**Google TensorFlow**. - The the
**best library for deep learning**in python for developers called Keras. - The development of deep learning models on Amazon cloud services to
**harness the speed of GPU hardware**for less than $1 per hour.

**The Multilayer Perceptron network, a foundation of deep learning including:**

- The basics of multilayer artificial neural networks needed to
**use them in practice**. - The 6-step process to develop
**your first neural network**with Keras in minutes. - The 3 methods that you can use to evaluate the performance of your neural networks, including one that gives
**the most robust estimates**. - The 2 best features of scikit-learn to leverage when developing neural networks with Keras, and the one that will
**save you hours**. - The 3
**end-to-end projects**that show you how to use Multilayer Perceptron networks for predictive modeling problems.

### MLPs, CNNs and RNNs

**The advanced techniques to when developing Multilayer Perceptrons, including:**

- The 2 formats that you can use to save your network structure to file and the HDF5 standard that you can use to
**save network weights**for later use. - The simple method to ensure that your
**results are not lost**if your multi-day run crashes half-way through. - The
**simple visualization technique**that you can use to check if your deep learning model is over learning or under learning your problem. - The simple and clever technique that you can use to
**reduce overfitting**. - The 2 methods you can use to dynamically change learning rate while training that gives you a
**lift in performance**.

**The Convolutional Neural Network, for computer vision tasks, including:**

- The basics of
**convolutional neural networks**needed to use them in practice such as their structure and learning method. - The problem of handwritten digit recognition and
**how to solve it**using convolutional neural networks. - The clever approach of image augmentation and 6 techniques you can use to
**improve the generalization**of your models. - The problem of
**object recognition in photographs**and how to solve it using convolutional neural networks of increasing size. - The application of convolutional neural networks to text data and how to use them to
**predict the sentiment of movie reviews**from the text alone.

**The Recurrent Neural Network, to learn complex sequences, including:**

- The basics of
**recurrent neural networks**needed to use them in practice including their structure and the most popular type. - The problem of time series prediction and a
**clever technique**to improve the performance for Multilayer Perceptrons on this problem. - The LSTM recurrent neural network and the 5 ways it can be used to model
**time series prediction problems**. - The
**clever framing of sentiment prediction**as the classification of a sequence of words and how to use LSTMs to solve it. - The example problem of predicting the next letter of the alphabet and its use to give you
**deeper insight into how LSTMs work**. - The invention of new sentences for
**Alice In Wonderland**by an LSTM network trained on the whole book.

### What More Do You Need?

## Take a Sneak Peek Inside The Ebook

## BONUS: Deep Learning Code Recipes

*…you also get 66 fully working deep learning scripts*

Each recipe presented in the book is standalone, meaning that you can copy and paste it into your project and use it immediately.

- You get one Python script (.py) for each example provided in the book.
- You get the datasets used throughout the book.

Your **Deep Learning Code Recipe Library** covers the following topics:

- Callbacks
- Dataset
- Data Augmentation
- Data Preparation
- Evaluation
- Learning Rate
- CIFAR-10 dataset
- IMDB dataset
- MLP Projects
- MNIST dataset
- Regularization
- Scikit-Learn
- Seralization
- Time Series Prediction
- LSTM Stateful Recurrent Networks
- Text Generation

This means that you can follow along and compare your answers to a known working implementation of each algorithm in the provided Python files.

This helps a lot to speed up your progress when working through the details of a specific task.

## About The Author

Hi, I'm Jason Brownlee.

I live in Australia with my wife and son and love to write and code.

I have a computer science background as well as a Masters and Ph.D. degree in Artificial Intelligence.

I’ve written books on algorithms, won and ranked in the top 10% in machine learning competitions, consulted for startups and spent a long time working on systems for forecasting tropical cyclones. (yes I have written tons of code that runs operationally)

I get a lot of satisfaction helping developers get started and get really good at machine learning.

I teach an unconventional top-down and results-first approach to machine learning where we start by working through tutorials and problems, then later wade into theory as we need it.

I'm here to help if you ever have any questions. I want you to be awesome at machine learning.

## Download Your Sample Chapter

Do you want to take a closer look at the book? Download a free sample chapter PDF.

Enter your email address and your sample chapter will be sent to your inbox.

Click Here to Download Your Sample Chapter

## Check Out What Customers Are Saying:

## You're Not Alone in Choosing Machine Learning Mastery

*Trusted by Over 10,000 Practitioners*

...including employees from companies like:

...students and faculty from universities like:

and many thousands more...

## Absolutely No Risk with...

*100% Money Back Guarantee*

Plus, as you should expect of any great product on the market, every Machine Learning Mastery Ebook

comes with the surest sign of confidence: my gold-standard 100% money-back guarantee.

**100% Money-Back Guarantee**

If you're not happy with your purchase of any of the Machine Learning Mastery Ebooks,

just email me within 90 days of buying, and * I'll give you your money back* ASAP.

#### No waiting. No questions asked. No risk.

## Get Started With Deep Learning Today

#### Choose Your Package:

## Basic Package

You will get:

- Deep Learning With Python

(*including bonus source code*)

(a great deal!)

## Python Pro Bundle

TOP SELLER

You get the 3-book set:

- Machine Learning Mastery With Python
- Deep Learning With Python
- XGBoost With Python

(*includes all bonus source code*)

(save $37, like getting a book for free!)

## Super Bundle

You get the complete 7-book set:

- Master Machine Learning Algorithms
- ML Algorithms From Scratch
- Machine Learning Mastery With Weka
- Machine Learning Mastery With R
- Machine Learning Mastery With Python
- Deep Learning With Python
- XGBoost With Python

(*includes all bonus source code*)

(save a massive $72)

(1) Click the button. (2) Enter your details. (3) Download your package immediately.

### Secure Payment Processing With SSL Encryption

**Have more Questions?**

#### Are you a Student?

#### Want it for the Team?

## What Are Skills in Machine Learning Worth?

Your boss asks you:

*Hey, can you build a predictive model for this?*

#### Imagine you had the skills and confidence to say:

"*YES!*"

...and follow through.

I have been there. It feels great!

### How much is that worth to you?

The industry is demanding skills in machine learning.

The market wants people that can deliver results, not write academic papers.

Business knows what these skills are worth and are paying sky-high starting salaries.

A Data Scientists Salary Begins at:**$100,000** to **$150,000**.

A Machine Learning Engineers Salary is Even Higher.

## What Are Your Alternatives?

You made it this far.

You're ready to take action.

But, what are your alternatives? What options are there?

**(1) A Theoretical Textbook for $100+ **

*...it's boring, math-heavy and you'll probably never finish it.*

**(2) An On-site Boot Camp for $10,000+ **

*...it's full of young kids, you must travel and it can take months.*

**(3) A Higher Degree for $100,000+ **

*...it's expensive, takes years, and you'll be an academic.*

OR...

For the **Hands-On Skills** You Get...

And the **Speed of Results** You See...

And the **Low Price** You Pay...

### Machine Learning Mastery Ebooks are

Amazing Value!

*And they work. That's why I offer the money-back guarantee.*

## You're A Professional

### The field moves quickly,

*...how long can you wait?*

You think you have all the time in the world, but...

- New methods are devised and algorithms change.
- New books get released and prices increase.
- New graduates come along and jobs get filled.

**Right Now is the Best Time to make your start.**

### Bottom-up is Slow and Frustrating,

*...don't you want a faster way?*

Can you really go on another day, week or month...

- Scraping ideas and code from incomplete posts.
- Skimming theory and insight from short videos.
- Parsing Greek letters from academic textbooks.

**Targeted Training is your Shortest Path to a result.**

### Professionals Use Training To Stay On Top Of Their Field

Get The Training You Need!

*You don't want to fall behind or miss the opportunity.*

## Frequently Asked Questions

**What programming language is used?** All examples use the Python programming language version 2 or 3. It assumes you have a working SciPy environment with NumPy, pandas, matplotlib and scikit-learn installed.

**Do I need to be a good programmer?** Not at all. This Ebook requires that you have a programmers mindset of thinking in procedures and learning by doing. You do not need to be an excellent programmer to read and learn about machine learning algorithms.

**How much math do I need to know?** No background in statistics, probability or linear algebra is required. We do not derive any equations.

**How many pages it the Ebook?** The Ebook is 256 pages.

**How many example Python scripts are included?** My personal library of 66 Python deep learning recipes are included.

**Is there a hard copy physical book?** Not at this stage. Ebook only.

**Will I get updates?** Yes. You will be notified about updates to the book and code that you can download for free.

**Is there any digital rights management (DRM)?** No, there is no DRM.

**How long will the Ebook take to complete?** I recommend reading one chapter per day. With 18 lessons and 9 projects and moving fast through the intro and conclusions, you can finish in 3 weeks. On the other hand, if you are keen you could work through all of the material in a weekend.

**What if I need help?** The final chapter is titled “*Getting More Help*” and points to resources that you can use to get more help with deep learning in Python.

**How much machine learning do I need to know?** Only a little. You will be lead step-by-step through the process of working a deep learning projects. It would help if you were already familiar with concepts like cross-validation.

**Are there any additional downloads?** Yes. In addition to the download for the Ebook itself, you will have access to my personal library of Python deep learning recipes.

**What operating systems are supported?** You can work through the book using Linux, Mac OS X and Windows. Note that TensorFlow is difficult to install on Windows, but is not needed to complete the book. All examples use Keras and the Theano backend is preferred for speed.