BUG fix compute_class_weights issue in SGD

Fixes #1749.