rbm code

please feel free to check and debug, thanks !