Learn R Programming

autoencoder (version 1.1)

visualize.hidden.units: Visualize features learned by a sparse autoencoder

Description

Visualizes features learned by a sparse autoencoder, by plotting (norm bounded) input images that maximally activate each of the hidden units of the trained autoencoder. Here it is assumed that the autoencoder is trained on a set of images of size Nx.patch by Ny.patch (in pixels).

Usage

visualize.hidden.units(object, Nx.patch, Ny.patch)

Arguments

object
an object of class autoencoder produced by the autoencode function, and containing information (architecture, weights, biases, unit type, etc.) about the autoencoder network.
Nx.patch
width (in pixels) of images in data set used for training the autoencoder. See 'Examples'.
Ny.patch
height (in pixels) of images in data set used for training the autoencoder. See 'Examples'.

Value

  • A figure in which each square shows the (norm bounded) input image of size Nx.patch by Ny.patch (in pixels) that maximally activates each of the hidden units. These squares represent the features learned by the autoencoder from the unlabeled data used for its training.

Examples

Run this code
## Load a pre-trained autoencoder object with N.input=100 and N.hidden=10*10,
## trained on unlabeled set of 5000 image patches of size 
## Nx.patch=10 by Ny.patch=10 pixels, 
## randomly cropped from 10 nature photos, and visualize the features 
## learned by its hidden units:

data('autoencoder_Ninput=100_Nhidden=100_rho=1e-2')          

## Visualize hidden units' learned features:
visualize.hidden.units(autoencoder.object,Nx.patch=10,Ny.patch=10)

Run the code above in your browser using DataLab