Skip to content

ENH Better error message needed when accidentall…#16861

Merged
thomasjpfan merged 1 commit intoscikit-learn:masterfrom
MichaelShoemaker:fix_param_msg
Apr 10, 2020
Merged

ENH Better error message needed when accidentall…#16861
thomasjpfan merged 1 commit intoscikit-learn:masterfrom
MichaelShoemaker:fix_param_msg

Conversation

@MichaelShoemaker
Copy link
Copy Markdown
Contributor

Fixes issue: #12640

Modified the error message wording to explicitly state that single values must be wrapped in a list.

Former Message:

ValueError: Parameter values for parameter (booster) need to be a sequence(but not a string) or np.ndarray.

Updated Message:

ValueError: Parameter grid for parameter (colsample_bytree) needs to be a list or numpy array, but got (<class 'int'>). Single values need to be wrapped in a list with one element.

Modified the def test_grid_search_bad_param_grid function in
test_search.py to accept the changes made in _search.py.
Copy link
Copy Markdown
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MichaelShoemaker !

@thomasjpfan thomasjpfan changed the title [MRG] #12640 FIX: Better error message needed when accidentally supplying scalar value to parameter tuning classes #12640 ENH Better error message needed when accidentall… Apr 10, 2020
@thomasjpfan thomasjpfan merged commit f31e25b into scikit-learn:master Apr 10, 2020
gio8tisu pushed a commit to gio8tisu/scikit-learn that referenced this pull request May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants