Move balance_weights out of preprocessing.

See #1763.