wrote code for contrastive divergence