Added inference method to EM.