def _e_step(psamples, W_list, b_list, n_steps=100, eps=1e-5):
    depth = len(psamples)

    # now alternate mean-field inference for even/odd layers
    def mf_iteration(*psamples):
        new_psamples = [p for p in psamples]
        for i in xrange(1, depth, 2):
            new_psamples[i] = hi_given(psamples, i, W_list, b_list)
        for i in xrange(2, depth, 2):
            new_psamples[i] = hi_given(psamples, i, W_list, b_list)

        score = 0.
        for i in xrange(1, depth):
            score = T.maximum(T.mean(abs(new_psamples[i] - psamples[i])),
                              score)

        return new_psamples, theano.scan_module.until(score < eps)

    new_psamples, updates = scan(
        mf_iteration,
        outputs_info=psamples,
        n_steps=n_steps
    )

    return [x[-1] for x in new_psamples]
Performs 'n_steps' of mean-field inference (used to compute positive phase
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/dbm_metrics.py/_e_step