restricted Boltzmann machine implementation (stochastic neural network)