A Method for Inferring Label Sampling Mechanisms in Semi-Supervised Learning