Skip to Content
Neural Network Projects with Python
book

Neural Network Projects with Python

by James Loy
February 2019
Beginner to intermediate
308 pages
7h 42m
English
Packt Publishing
Content preview from Neural Network Projects with Python

Building autoencoders in Keras

First, let's start building our basic autoencoder in Keras. As always, we'll use the Sequential class in Keras to build our model.

We'll start by importing and defining a new Sequential class in Keras:

from keras.models import Sequentialmodel = Sequential()

Next, we'll add the hidden layer to our model. From the previous diagram, we can clearly see that the hidden layer is a fully connected layer (that is, a Dense layer). From the Dense class in Keras, we can define the size of the hidden layer through the units parameter. The number of units is a hyperparameter that we will be experimenting with. For now, let's use a single node (units=1) as the hidden layer. The input_shape to the Dense layer is a vector of ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning with Python Cookbook

Machine Learning with Python Cookbook

Chris Albon

Publisher Resources

ISBN: 9781789138900Supplemental Content