Implementation using Deeplearning4j
This section of the chapter will provide a basic idea of how to write the code for RBMs and DBNs using Deeplearning4j. Readers will be able to learn the syntax for using the various hyperparameters mentioned in this chapter.
To implement RBMs and DBNs using Deeplearning4j, the whole idea is very simple. The overall implementation can be split into three core phases: loading data or preparation of the data, network configuration, and training and evaluation of the model.
In this section, we will first discuss RBMs on IrisDataSet, and then we will come to the implementation of DBNs.
Restricted Boltzmann machines
For the building and training of RBMs, first we need to define and initialize the hyperparameter needed for the model:
Nd4j.MAX_SLICES_TO_PRINT = -1; Nd4j.MAX_ELEMENTS_PER_SLICE = -1; Nd4j.ENFORCE_NUMERICAL_STABILITY = true; final int numRows = 4; final int numColumns = 1; int outputNum = 10; int numSamples ...