<h4 dir="auto">Description</h4>
<p dir="auto">Type error thrown when handing over an options dictionary to gridsearchs fit method like so:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="grid_search.fit(train[[&quot;A&quot;, &quot;B&quot;]], train[&quot;C&quot;], **fit_options)"><pre class="notranslate"><span class="pl-s1">grid_search</span>.<span class="pl-en">fit</span>(<span class="pl-s1">train</span>[[<span class="pl-s">"A"</span>, <span class="pl-s">"B"</span>]], <span class="pl-s1">train</span>[<span class="pl-s">"C"</span>], <span class="pl-c1">**</span><span class="pl-s1">fit_options</span>)</pre></div>
<p dir="auto">This worked for 0.21.3, but doesn't for 0.22.0, so this might be a regression. Behavior change was introduced here: <a href="https://github.com/scikit-learn/scikit-learn/blame/master/sklearn/model_selection/_search.py#L651">https://github.com/scikit-learn/scikit-learn/blame/master/sklearn/model_selection/_search.py#L651</a></p>
<h4 dir="auto">Steps/Code to Reproduce</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from sklearn.linear_model import HuberRegressor
from sklearn.model_selection import GridSearchCV
import pandas as pd

train = pd.DataFrame({&quot;A&quot;: [1, 2, 3, 5, 2], &quot;B&quot;: [4, 5, 6, 4, 1], &quot;C&quot;: [5, 7, 9, 9, 3]})

hyper_parameter_tune = {
    &quot;epsilon&quot;: [1, 1.5]
}

fit_options = {
    &quot;sample_weight&quot;: 1
}

gridsearch_params = {
    &quot;cv&quot;: 2
}

gsearch = GridSearchCV(param_grid=hyper_parameter_tune,
                       estimator=HuberRegressor(),
                       **gridsearch_params
                       )

gsearch.fit(train[[&quot;A&quot;, &quot;B&quot;]], train[&quot;C&quot;], **fit_options)

observation = pd.DataFrame({&quot;A&quot;: [5], &quot;B&quot;: [2]})

print(gsearch.predict(observation))"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">linear_model</span> <span class="pl-k">import</span> <span class="pl-v">HuberRegressor</span>
<span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">model_selection</span> <span class="pl-k">import</span> <span class="pl-v">GridSearchCV</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>

<span class="pl-s1">train</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">"A"</span>: [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">5</span>, <span class="pl-c1">2</span>], <span class="pl-s">"B"</span>: [<span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>, <span class="pl-c1">4</span>, <span class="pl-c1">1</span>], <span class="pl-s">"C"</span>: [<span class="pl-c1">5</span>, <span class="pl-c1">7</span>, <span class="pl-c1">9</span>, <span class="pl-c1">9</span>, <span class="pl-c1">3</span>]})

<span class="pl-s1">hyper_parameter_tune</span> <span class="pl-c1">=</span> {
    <span class="pl-s">"epsilon"</span>: [<span class="pl-c1">1</span>, <span class="pl-c1">1.5</span>]
}

<span class="pl-s1">fit_options</span> <span class="pl-c1">=</span> {
    <span class="pl-s">"sample_weight"</span>: <span class="pl-c1">1</span>
}

<span class="pl-s1">gridsearch_params</span> <span class="pl-c1">=</span> {
    <span class="pl-s">"cv"</span>: <span class="pl-c1">2</span>
}

<span class="pl-s1">gsearch</span> <span class="pl-c1">=</span> <span class="pl-v">GridSearchCV</span>(<span class="pl-s1">param_grid</span><span class="pl-c1">=</span><span class="pl-s1">hyper_parameter_tune</span>,
                       <span class="pl-s1">estimator</span><span class="pl-c1">=</span><span class="pl-v">HuberRegressor</span>(),
                       <span class="pl-c1">**</span><span class="pl-s1">gridsearch_params</span>
                       )

<span class="pl-s1">gsearch</span>.<span class="pl-en">fit</span>(<span class="pl-s1">train</span>[[<span class="pl-s">"A"</span>, <span class="pl-s">"B"</span>]], <span class="pl-s1">train</span>[<span class="pl-s">"C"</span>], <span class="pl-c1">**</span><span class="pl-s1">fit_options</span>)

<span class="pl-s1">observation</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">"A"</span>: [<span class="pl-c1">5</span>], <span class="pl-s">"B"</span>: [<span class="pl-c1">2</span>]})

<span class="pl-en">print</span>(<span class="pl-s1">gsearch</span>.<span class="pl-en">predict</span>(<span class="pl-s1">observation</span>))</pre></div>
<h4 dir="auto">Expected Results</h4>
<p dir="auto">No Error thrown: TypeError: Singleton array array(1) cannot be considered a valid collection</p>
<h4 dir="auto">Actual Results</h4>
<p dir="auto">Traceback (most recent call last):<br>
File "/home/stepo/PycharmProjects/untitled/test.py", line 24, in <br>
gsearch.fit(train[["A", "B"]], train["C"], groups=None, **fit_options)<br>
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/model_selection/_search.py", line 652, in fit<br>
fit_params_values = indexable(*fit_params.values())<br>
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 237, in indexable<br>
check_consistent_length(*result)<br>
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 208, in check_consistent_length<br>
lengths = [_num_samples(X) for X in arrays if X is not None]<br>
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 208, in <br>
lengths = [_num_samples(X) for X in arrays if X is not None]<br>
File "/home/stepo/PycharmProjects/untitled/venv/lib/python3.7/site-packages/sklearn/utils/validation.py", line 152, in _num_samples<br>
" a valid collection." % x)<br>
TypeError: Singleton array array(1) cannot be considered a valid collection.</p>
<h4 dir="auto">Versions</h4>
<p dir="auto">System:<br>
python: 3.7.5 (default, Nov 20 2019, 09:21:52)  [GCC 9.2.1 20191008]<br>
executable: /home/stepo/PycharmProjects/untitled/venv/bin/python<br>
machine: Linux-5.3.0-24-generic-x86_64-with-Ubuntu-19.10-eoan</p>
<p dir="auto">Python dependencies:<br>
pip: 19.0.3<br>
setuptools: 40.8.0<br>
sklearn: 0.22<br>
numpy: 1.17.4<br>
scipy: 1.3.3<br>
Cython: None<br>
pandas: 0.25.3<br>
matplotlib: None<br>
joblib: 0.14.1</p>
<p dir="auto">Built with OpenMP: True</p>
<p dir="auto"><strong>UPDATE May 23 202</strong></p>
<p dir="auto">Here's a list of the remaining classes:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> feature_selection.SelectorMixin</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> calibration.CalibratedClassifierCV (<a href="https://github.com/scikit-learn/scikit-learn/pull/15134" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/15134/hovercard">#15134</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> decomposition.DictionaryLearning (<a href="https://github.com/scikit-learn/scikit-learn/pull/16907" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/16907/hovercard">#16907</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> decomposition.MiniBatchDictionaryLearning (<a href="https://github.com/scikit-learn/scikit-learn/pull/16907" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/16907/hovercard">#16907</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> decomposition.SparseCoder (<a href="https://github.com/scikit-learn/scikit-learn/pull/15233" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/15233/hovercard">#15233</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> ensemble.GradientBoostingClassifier</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> gaussian_process.kernels.CompoundKernel</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> gaussian_process.kernels.Hyperparameter</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> gaussian_process.kernels.Kernel</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> gaussian_process.kernels.PairwiseKernel</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> inspection.PartialDependenceDisplay</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> linear_model.PoissonRegressor</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> linear_model.TweedieRegressor</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> linear_model.GammaRegressor</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> metrics.ConfusionMatrixDisplay</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> metrics.PrecisionRecallDisplay</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> mixture.BayesianGaussianMixture</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> mixture.GaussianMixture</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> multioutput.ClassifierChain (<a href="https://github.com/scikit-learn/scikit-learn/pull/15211" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/15211/hovercard">#15211</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> multioutput.RegressorChain (<a href="https://github.com/scikit-learn/scikit-learn/pull/15215" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/15215/hovercard">#15215</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> neighbors.BallTree</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> neighbors.DistanceMetric</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> neighbors.KDTree</li>
</ul>
<hr>
<p dir="auto">Most of the docs in classes lack examples. It would be great to add one or two examples similar to this, <a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html" rel="nofollow">http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html</a><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/449558/42726195-f31a227c-8755-11e8-8156-57ecf714614c.png"><img src="https://user-images.githubusercontent.com/449558/42726195-f31a227c-8755-11e8-8156-57ecf714614c.png" alt="image" style="max-width: 100%;"></a></p>