Learning to Speed Up Structured Output Prediction