<div dir="auto"><pre style="margin-top:0px;margin-bottom:0px;padding:10px;border:0px;font-size:13px;line-height:inherit;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace;vertical-align:baseline;word-wrap:normal;background-color:rgb(240,240,240);max-height:300px;color:rgb(12,13,14)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;line-height:inherit;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace;vertical-align:baseline;max-height:300px">
</code></pre><div dir="auto">Hello Antonio,</div><div dir="auto"><br></div><div dir="auto">Sure:</div><div dir="auto"><pre style="margin-top:0px;margin-bottom:0px;padding:10px;border:0px;font-size:13px;line-height:inherit;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace;vertical-align:baseline;word-wrap:normal;background-color:rgb(240,240,240);max-height:300px;color:rgb(12,13,14)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;line-height:inherit;font-family:'consolas','menlo','monaco','lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace;vertical-align:baseline;max-height:300px">import sklearn
print(sklearn.__version__)
0.18.1
</code></pre><br></div><div dir="auto">The error suggests that the fit function is expecting a split vector with size 2/3*1000 but the whole vector (size 1000) is passed.</div><br><div class="gmail_extra" dir="auto"><pre style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;font-size:13px;line-height:inherit;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace;vertical-align:baseline;word-wrap:normal;background-color:rgb(240,240,240);max-height:300px;color:rgb(12,13,14)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;line-height:inherit;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace;vertical-align:baseline;max-height:300px">...
ValueError: Found a sample_weight array with shape (1000,) for an input with shape (666, 1). sample_weight cannot be broadcast.
</code></pre><p style="margin:0px 0px 0.8em;padding:0px;border:0px;font-size:15px;line-height:inherit;font-family:"helvetica neue",helvetica,arial,sans-serif;vertical-align:baseline;color:rgb(12,13,14);background-color:rgb(255,255,255)"><br></p><p style="margin:0px 0px 0.8em;padding:0px;border:0px;font-size:15px;line-height:inherit;font-family:"helvetica neue",helvetica,arial,sans-serif;vertical-align:baseline;color:rgb(12,13,14);background-color:rgb(255,255,255)"><br></p><div class="gmail_quote">El 22 jun. 2017 11:49 p. m., "Julio Antonio Soto de Vicente" <<a href="mailto:julio@esbet.es">julio@esbet.es</a>> escribió:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi Manuel,</div><div id="m_8385113245441922112AppleMailSignature"><br></div><div id="m_8385113245441922112AppleMailSignature">Are you sure that you are using the latest version (or at least >0.17)? The code for splitting the sample weights in GridSearchCV has been there for a while now...<br><br>--<div>Julio</div></div><div class="elided-text"><div><br>El 22 jun 2017, a las 23:33, Manuel Castejón Limas <<a href="mailto:manuel.castejon@gmail.com" target="_blank">manuel.castejon@gmail.com</a>> escribió:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div dir="ltr">Dear all,<div>I posted the full question on StackOverflow and as it contains some figures I refer you to that post. </div><div><br></div><div><a href="https://stackoverflow.com/questions/44661926/sample-weight-parameter-shape-error-in-scikit-learn-gridsearchcv/44662285#44662285" target="_blank">https://stackoverflow.com/ques<wbr>tions/44661926/sample-weight-<wbr>parameter-shape-error-in-<wbr>scikit-learn-gridsearchcv/4466<wbr>2285#44662285<br></a></div><div><br></div><div>I currently believe that this issue is a bug and I opened an issue on GitHub.</div><div><br></div><div>To sum up, the issue is that GridSearchCV does not handle the splitting of the sample_weight vector during cross validation.</div><div><br></div><div>Nota bene: cross_val_score seems to handle the splitting OK, this issue seems to occurr only in GridSearchCV.</div><div><br></div><div>Any comments enlightening me and showing me how wrong I am are most welcome.</div><div><br></div><div><br></div><div><br></div></div>
</div><br></div>
</div></blockquote></div><blockquote type="cite"><div><span>______________________________<wbr>_________________</span><br><span>scikit-learn mailing list</span><br><span><a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a></span><br><span><a href="https://mail.python.org/mailman/listinfo/scikit-learn" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a></span><br></div></blockquote></div><br>______________________________<wbr>_________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a><br>
<br></blockquote></div><br></div></div>