Loss factorization, weakly supervised learning and label noise robustness