Basic autoencoders

Let's look at a basic example of an autoencoder that also happens to be a basic autoencoder. First, we will create an AutoEncoder class and initialize it with the following parameters passed to __init__():

  • num_input: Number of input samples
  • num_hidden: Number of neurons in the hidden layer
  • transfer_function=tf.nn.softplus: Transfer function
  • optimizer = tf.train.AdamOptimizer(): Optimizer
You can either pass a custom transfer_function and optimizer or use the default one specified. In our example, we are using softplus as the default transfer_function (also called activation function): f(x)=ln(1+ex).

Get Neural Network Programming with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.