RBM python code implementation