A semiparametric generative model for efficient structured-output supervised learning