Domain Generalization via Conditional Invariant Representations