A Learning Error Analysis for Structured Prediction with Approximate Inference