refactoring - contrastive divergence