Combining Generative and Discriminative Models for Hybrid Inference