Imposing And Uncovering Group Structure In Weakly-Supervised Learning