A Structured Prediction Approach to Robot Imitation Learning