Example of unsupervised DBN in Python

In this example, we are going to use a Python library freely available on GitHub (https://github.com/albertbup/deep-belief-network) that allows working with supervised and unsupervised DBN using NumPy (CPU-only) or Tensorflow (CPU or GPU support) with the standard Scikit-Learn interface. Our goal is to create a lower-dimensional representation of a subset of the mnist dataset (as the training process can be quite slow, we'll limit it to 400 samples). The first step is loading (using the Keras helper function), shuffling, and normalizing the dataset:

import numpy as npfrom keras.datasets import mnistfrom sklearn.utils import shuffle(X_train, Y_train), (_, _) = mnist.load_data()X_train, Y_train = shuffle(X_train, ...

Get Mastering Machine Learning Algorithms 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.