Estimating and controlling the uncertainty of learning machines