-
-
Notifications
You must be signed in to change notification settings - Fork 26k
Solving: Incorrectly Specified Error Message (#7600) #7609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -306,7 +306,7 @@ def convert_feature(fx): | |||
l.append(feature_names[i]) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong fix. This was not the issue.
@@ -306,7 +306,7 @@ def convert_feature(fx): | |||
l.append(feature_names[i]) | |||
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) ' | |||
'but was %d' % i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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