{"action":"opened","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11401","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11401/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11401/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/11401/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/11401","id":337511481,"node_id":"MDU6SXNzdWUzMzc1MTE0ODE=","number":11401,"title":"check_array does not raise error when input contains something other than numbers or strings","user":{"login":"jeremiedbb","id":34657725,"node_id":"MDQ6VXNlcjM0NjU3NzI1","avatar_url":"https://avatars2.githubusercontent.com/u/34657725?v=4","gravatar_id":"","url":"https://api.github.com/users/jeremiedbb","html_url":"https://github.com/jeremiedbb","followers_url":"https://api.github.com/users/jeremiedbb/followers","following_url":"https://api.github.com/users/jeremiedbb/following{/other_user}","gists_url":"https://api.github.com/users/jeremiedbb/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremiedbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremiedbb/subscriptions","organizations_url":"https://api.github.com/users/jeremiedbb/orgs","repos_url":"https://api.github.com/users/jeremiedbb/repos","events_url":"https://api.github.com/users/jeremiedbb/events{/privacy}","received_events_url":"https://api.github.com/users/jeremiedbb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-02T13:09:12Z","updated_at":"2018-07-02T13:09:12Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Now that imputers allow inputs with object dtype, e.g. strings or pandas categoricals, it seems that either `check_array` should be enhanced or that some common tests should be updated.\r\nThere is common test, `check_dtype_object`, that checks the estimators on input `X` that contains numbers and `X[0,0] = {'foo':'bar'}`. When expecting numeric inputs, the `check_array` is instanciated with `dtype='numeric'` and an error is raised as expected.\r\nHowever, when instanciated  with `dtype=None`  or  `dtype=object`, no error is raised. See the code below:\r\n\r\n```python\r\nX = np.array([{'foo':'bar'}, \"a\", \"b\", \"c\"], dtype=object).reshape(-1, 1)\r\nX\r\n>>> array([[{'foo': 'bar'}],\r\n           ['a'],\r\n           ['b'],\r\n           ['c']], dtype=object)\r\nimputer = SimpleImputer(strategy='constant', missing_values='a')\r\nimputer.fit_transform(X)\r\n>>> array([[{'foo': 'bar'}],\r\n           ['missing_value'],\r\n           ['b'],\r\n           ['c']], dtype=object)\r\n```\r\nNo error is raised and the estimator works fine. Don't you think that we should raise an error in that case ?\r\nThis currently passes the test because when imputing on inputs with object dtypes, we can't set `dtype='numeric'` in `check_array`. I think the error should be raised even with `dtype=object` or `dtype=None`.\r\n\r\nWe could check that in the `fit` function of the estimators that accept non-numeric inputs, but I think it the role of `check_array` to do that. What's your opinion about that ?\r\n\r\n\r\n\r\n "}}
{"actor":{"display_login":"jeremiedbb"}}