Backport to work with sklearn 0.15