[MRG] FIX for exception thrown when y does not have all classes

This is a fix for #3581
This is a good point, a divide by 0 warning will be thrown and the class weight will be infinity, though theoretically that shouldn't be a problem because the class_weight shouldn't be used (because the class is not in y). It's bad to have a warning thrown though so I'm not sure what the best course of action is here. I suppose as a hack we can do what you mentioned (manually set it to 1).