scikit-learn/scikit-learn — pull request #1746 by gatagat (2013-03-06 18:11:55+00:00)
Title: Fix automatic setup of class weights.

Automatic setup of class weights works only when the classes are numbered by {0, 1, .., n-1}. For this case the mapping done on sklearn/svm/base.py#141 by a call to unique(y, return_inverse=True) is identity.

For classes numbered differently (eg. just shifting the target), the class weights setup causes division by zero and subsequent mediocre performance of the classifier (prediction of a single class).