It may be essential to model Pr(L|X,S); this is called Inference in the context of probabilistic graphical models.