Error Estimation for Pattern Recognition