A Bayesian model of capacity across trials