More MP-DBM functionality

This adds the cost function used to train the MP-DBM.