A Structured Prediction Approach for Robot Imitation Learning