Extracting RBM components from MNIST

Let's now create our first RBM in scikit-learn. We will start by instantiating a module to extract 100 components from our MNIST dataset.

We will also set the verbose parameter to True to allow us visibility into the training process as well as the random_state parameter to 0. The random_state parameter is an integer that allows for reproducibility in code. It fixes the random number generator and sets the weights and biases randomly at the same time, every time. We finally let n_iter be 20. This is the number of iterations we wish to do, or back and forth passes of the network:

# instantiate our BernoulliRBM # we set a random_state to initialize our weights and biases to the same starting point # verbose ...

Get Feature Engineering Made Easy 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.