Model-Based Domain Generalization