Solving: Incorrectly Specified Error Message (#7600)#7609
Solving: Incorrectly Specified Error Message (#7600)#7609PNR-1 wants to merge 3 commits intoscikit-learn:masterfrom PNR-1:errormessage
Conversation
| names.append(l) | ||
| except IndexError: | ||
| raise ValueError('features[i] must be in [0, n_features) ' | ||
| raise ValueError('feature_names[i] must be in [0, n_features) ' |
There was a problem hiding this comment.
Wrong fix. This was not the issue.
| except IndexError: | ||
| raise ValueError('features[i] must be in [0, n_features) ' | ||
| raise ValueError('feature_names[i] must be in [0, n_features) ' | ||
| 'but was %d' % i) |
There was a problem hiding this comment.
This is the issue: i should be features[i]
|
Looks ok. |
|
I hope this solves the erroneous error message. (See what I did there) |
|
No, I meant: there was no issue with the error message, only with what was substituted into the |
|
Ohh. Sorry, I mistook it. Thanks a lot for helping me out. |
|
I'm not sure this is resolved. The value error is being thrown by an attempt to access Maybe something like the following would work?
|
jnothman
left a comment
There was a problem hiding this comment.
Could you please also write a test that the error message is correct in the case of invalid features data?
| @@ -307,7 +307,7 @@ def convert_feature(fx): | |||
| names.append(l) | |||
| except IndexError: | |||
| raise ValueError('features[i] must be in [0, n_features) ' | |||
There was a problem hiding this comment.
yes, perhaps @tetraptych is right that this would be clearer as len(feature_names)
|
@Doppler010 why did you close? Do you not want to work on this any more? |
|
@amueller I'll pick this up if @Doppler010 is out. I read over the docs for this, and it looks like the intended usage is for |
Fixes #7600