Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Deep Learning Cookbook

You're reading from   Python Deep Learning Cookbook Over 75 practical recipes on neural network modeling, reinforcement learning, and transfer learning using Python

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787125193
Length 330 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Indra den Bakker Indra den Bakker
Author Profile Icon Indra den Bakker
Indra den Bakker
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Programming Environments, GPU Computing, Cloud Solutions, and Deep Learning Frameworks FREE CHAPTER 2. Feed-Forward Neural Networks 3. Convolutional Neural Networks 4. Recurrent Neural Networks 5. Reinforcement Learning 6. Generative Adversarial Networks 7. Computer Vision 8. Natural Language Processing 9. Speech Recognition and Video Analysis 10. Time Series and Structured Data 11. Game Playing Agents and Robotics 12. Hyperparameter Selection, Tuning, and Neural Network Learning 13. Network Internals 14. Pretrained Models

Applying pooling layers


A popular optimization technique for CNNs is pooling layers. A layer is a method to reduce the number of trainable parameters in a smart way. Two of the most commonly used pooling layers are average pooling and maximum (max) pooling. In the first, for a specified block size the inputs are averaged and extracted. For the latter, the maximum value within a block is extracted. These pooling layers provide a translational invariance. In other words, the exact location of a feature is less relevant. Also, by reducing the number of trainable parameters we limit the complexity of the network, which should prevent overfitting. Another benefit is that it will reduce the training and inference time significantly.

In the next recipe, we will add max pooling layers to the CNN we've implemented in the previous recipe and at the same time we will increase the number of filters in the convolutional layers.

How to do it...

  1. Import all necessary libraries:
import numpy as np

from keras...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image