Restricted boltzmann machine implementation (stochastic neural network)