in begin of reimplemented RBM+DBN