Machine learning with probabilistic reweighting