[MRG+2] check_array Error message#9068
Conversation
|
@jnothman is this what you had in mind? RFC before propagating the changes to the tests |
check_array Error messagecheck_array Error message
check_array Error messagecheck_array Error message
|
LGTM. Thanks |
|
Actually: not LGTM: you need to change all the error messages in the tests. The tests currently fail |
|
@GaelVaroquaux, yep I wanted confirmation before changing ALL the testing. I let this for the monkey time, which I think it would come earlier than I would like. |
sklearn/utils/validation.py
Outdated
| "Got X with X.ndim=1. Reshape your data either using " | ||
| "X.reshape(-1, 1) if your data has a single feature or " | ||
| "X.reshape(1, -1) if it contains a single sample.") | ||
| "Expected 2D array, got 1D array instead: array={}. " |
There was a problem hiding this comment.
I would put a newline after the array printing
There was a problem hiding this comment.
Even maybe "got 1D array instead:\n{}\n". Otherwise the first row of the array will not be vertically aligned with the other rows
check_array Error messagecheck_array Error message
|
flake8 error: |
|
LGTM |
check_array Error messagecheck_array Error message
|
ping @jnothman |
|
a few seconds too late to comment on this one ... |
|
Sorry, was there a comment to be heard? |
import numpy as np
from sklearn.utils.validation import check_array
check_array(np.array([1., 2., 3.]), ensure_2d=True)The message would be better formatted like this: and it would be nice to add a test in |
|
I've added @lesteve comments. How should I reopen the PR? |
|
You need to open a new PR |
Reference Issue
Fixes #9047
What does this implement/fix? Explain your changes.
Any other comments?