You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No Error thrown: TypeError: Singleton array array(1) cannot be considered a valid collection
Actual Results
Traceback (most recent call last):
File "/home/stepo/PycharmProjects/untitled/test.py", line 24, in
gsearch.fit(train[["A", "B"]], train["C"], groups=None, **fit_options)
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/model_selection/_search.py", line 652, in fit
fit_params_values = indexable(*fit_params.values())
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 237, in indexable
check_consistent_length(*result)
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 208, in check_consistent_length
lengths = [_num_samples(X) for X in arrays if X is not None]
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 208, in
lengths = [_num_samples(X) for X in arrays if X is not None]
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 152, in _num_samples
" a valid collection." % x)
TypeError: Singleton array array(1) cannot be considered a valid collection.
Description
Type error thrown when handing over an options dictionary to gridsearchs fit method like so:
This worked for 0.21.3, but doesn't for 0.22.0, so this might be a regression. Behavior change was introduced here: https://github.com/scikit-learn/scikit-learn/blame/master/sklearn/model_selection/_search.py#L651
Steps/Code to Reproduce
Expected Results
No Error thrown: TypeError: Singleton array array(1) cannot be considered a valid collection
Actual Results
Traceback (most recent call last):
File "/home/stepo/PycharmProjects/untitled/test.py", line 24, in
gsearch.fit(train[["A", "B"]], train["C"], groups=None, **fit_options)
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/model_selection/_search.py", line 652, in fit
fit_params_values = indexable(*fit_params.values())
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 237, in indexable
check_consistent_length(*result)
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 208, in check_consistent_length
lengths = [_num_samples(X) for X in arrays if X is not None]
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 208, in
lengths = [_num_samples(X) for X in arrays if X is not None]
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 152, in _num_samples
" a valid collection." % x)
TypeError: Singleton array array(1) cannot be considered a valid collection.
Versions
System:
python: 3.7.5 (default, Nov 20 2019, 09:21:52) [GCC 9.2.1 20191008]
executable: /home/stepo/PycharmProjects/untitled/venv/bin/python
machine: Linux-5.3.0-24-generic-x86_64-with-Ubuntu-19.10-eoan
Python dependencies:
pip: 19.0.3
setuptools: 40.8.0
sklearn: 0.22
numpy: 1.17.4
scipy: 1.3.3
Cython: None
pandas: 0.25.3
matplotlib: None
joblib: 0.14.1
Built with OpenMP: True
The text was updated successfully, but these errors were encountered: