MRG Class weight refactor

New PR as I messed up #1464.

@ogrisel gave his +1 there.

@erg your comments would still be welcome.

Also more comments by @larsmans and @mblondel ;)