<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    We could clarify in the documentation that you can grid-search any
    (hyper) parameter of a model,<br>
    but not parameters to fit?<br>
    Only the values returned by get_params() can be tuned.<br>
    Only "param_grid" will be searched, not "fit_params". "fit_params"
    can contain only a single setting.<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 06/26/2017 03:17 AM, Joel Nothman
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAkaFLW08UCka6DQtAUgK2g+mDDepgJqgiH9Ya_s+8zN7VFJAA@mail.gmail.com">
      <div dir="ltr">I don't think we'll be accepting a pull request
        adding this feature to scikit-learn. It is too niche. But you
        should go ahead and modify the search to operate over weightings
        for your own research. If you feel the documentation can be
        clarified, a pull request there is welcome.</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 26 June 2017 at 16:43, Manuel
          CASTEJÓN LIMAS <span dir="ltr"><<a
              href="mailto:mcasl@unileon.es" target="_blank"
              moz-do-not-send="true">mcasl@unileon.es</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="auto">
              <div>Yes, I guess most users will be happy without using
                weights. Some will need to use one single vector, but I
                am currently researching a weighting method thus my need
                of evaluating multiple weight vectors.</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto"> I understand that it seems to be a very
                specific issue with a simple workaround, most likely not
                worthy of any programming  effort yet as there are more
                important issues to address. </div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">I guess that adding a note on this
                behaviour on the documentation could be great. If some
                parameters can be iterated and others are not supported
                knowing it  provides a more solid ground to the user
                base.</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">I'm committed to spend a few hours
                studying the code. Should I be successful  I will come
                again with a pull request.</div>
              <div dir="auto">I'll cross my fingers :-)</div>
              <div dir="auto">Best</div>
              <div dir="auto">Manolo</div>
              <div>
                <div class="h5">
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">
                    <div class="gmail_extra" dir="auto"><br>
                      <div class="gmail_quote">El 24 jun. 2017 20:05,
                        "Julio Antonio Soto de Vicente" <<a
                          href="mailto:julio@esbet.es" target="_blank"
                          moz-do-not-send="true">julio@esbet.es</a>>
                        escribió:<br type="attribution">
                        <blockquote class="m_3791487926611240532quote"
                          style="margin:0 0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div dir="auto">
                            <div>Joel is right.</div>
                            <div
                              id="m_3791487926611240532m_969618319005634009AppleMailSignature"><br>
                            </div>
                            <div
                              id="m_3791487926611240532m_969618319005634009AppleMailSignature">In
                              fact, you usually don't want to tune a lot
                              the sample weights: you may leave them
                              default, set them in order to balance
                              classes, or fix them according to some
                              business rule.</div>
                            <div
                              id="m_3791487926611240532m_969618319005634009AppleMailSignature"><br>
                            </div>
                            <div
                              id="m_3791487926611240532m_969618319005634009AppleMailSignature">That
                              said, you can always run a couple of grid
                              searchs changing that sample weights and
                              compare results afterwards.<br>
                              <br>
                              --
                              <div>Julio</div>
                            </div>
                            <div
                              class="m_3791487926611240532elided-text">
                              <div><br>
                                El 24 jun 2017, a las 15:51, Joel
                                Nothman <<a
                                  href="mailto:joel.nothman@gmail.com"
                                  target="_blank" moz-do-not-send="true">joel.nothman@gmail.com</a>>
                                escribió:<br>
                                <br>
                              </div>
                              <blockquote type="cite">
                                <div>
                                  <div dir="auto">yes, trying multiple
                                    sample weightings is not supported
                                    by grid search directly.</div>
                                  <div class="gmail_extra"><br>
                                    <div class="gmail_quote">On 23 Jun
                                      2017 6:36 pm, "Manuel Castejón
                                      Limas" <<a
                                        href="mailto:manuel.castejon@gmail.com"
                                        target="_blank"
                                        moz-do-not-send="true">manuel.castejon@gmail.com</a>>
                                      wrote:<br type="attribution">
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">
                                        <div dir="ltr">Dear Joel,
                                          <div><br>
                                          </div>
                                          <div>I tried and removed the
                                            square brackets and now it
                                            works as expected <b>for a
                                              single</b> sample_weight
                                            vector:</div>
                                          <div><br>
                                          </div>
                                          <div>
                                            <pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;color:rgb(36,41,46)"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0px;margin:0px;background:transparent;border-radius:3px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal">validator = GridSearchCV(my_Regressor,
                     param_grid={'number_of_hidden_<wbr>neurons': range(4, 5),
                                 'epochs': [50],
                                },
                     fit_params={'sample_weight':  my_sample_weights },
                     n_jobs=1,
                    )
validator.fit(x, y)</code></pre>
                                            <div class="gmail_extra">The
                                              problem now is that I want
                                              to try multiple trainings
                                              with multiple
                                              sample_weight parameters,
                                              in the following fashion:</div>
                                            <div class="gmail_extra"><br>
                                            </div>
                                            <div class="gmail_extra">
                                              <pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;color:rgb(36,41,46)"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0px;margin:0px;background:transparent;border-radius:3px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal">validator = GridSearchCV(my_Regressor,
                     param_grid={'number_of_hidden_<wbr>neurons': range(4, 5),
                                 'epochs': [50],
                                 'sample_weight':  [my_sample_weights, my_sample_weights**2] ,
                                },
                     fit_params={},
                     n_jobs=1,
                    )
validator.fit(x, y)</code></pre>
                                            </div>
                                            <div class="gmail_extra">But
                                              unfortunately it produces
                                              the same error again:</div>
                                            <div class="gmail_extra"><br>
                                            </div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation
Mono",Menlo,Courier,monospace;font-size:11.9px;background-color:rgba(27,31,35,0.05)">ValueError:
                                                Found a sample_weight
                                                array with shape (1000,)
                                                for an input with shape
                                                (666, 1). sample_weight
                                                cannot be broadcast.</span><br>
                                            </div>
                                            <div class="gmail_extra"><br>
                                            </div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px">I
                                                guess that the issue is
                                                that the sample__weight
                                                parameter was not
                                                thought to be changed
                                                during the tuning, was
                                                it?</span><br>
                                            </div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px"><br>
                                              </span></div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px"><br>
                                              </span></div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px">Thank
                                                you all for your
                                                patience and support.</span></div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px">Best</span></div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px">Manolo</span></div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px"><br>
                                              </span></div>
                                            <div class="gmail_extra"><span
style="color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe
UI",Helvetica,Arial,sans-serif,"Apple Color
                                                Emoji","Segoe
                                                UI
                                                Emoji","Segoe
                                                UI
                                                Symbol";font-size:14px"><br>
                                              </span></div>
                                            <div class="gmail_extra"><br>
                                            </div>
                                            <div class="gmail_extra"><br>
                                              <div class="gmail_quote">2017-06-23
                                                1:17 GMT+02:00 Manuel
                                                CASTEJÓN LIMAS <span
                                                  dir="ltr"><<a
                                                    href="mailto:mcasl@unileon.es"
                                                    target="_blank"
                                                    moz-do-not-send="true">mcasl@unileon.es</a>></span>:<br>
                                                <blockquote
                                                  class="gmail_quote"
                                                  style="margin:0px 0px
                                                  0px
                                                  0.8ex;border-left:1px
                                                  solid
                                                  rgb(204,204,204);padding-left:1ex">
                                                  <div dir="auto">Dear
                                                    Joel,
                                                    <div dir="auto">I'm
                                                      just passing an
                                                      iterable as I
                                                      would do with any
                                                      other sequence of
                                                      parameters to
                                                      tune. In this case
                                                      the list only has
                                                      one element to use
                                                      but in general I
                                                      ought to be able
                                                      to pass a
                                                      collection of
                                                      vectors.</div>
                                                    <div dir="auto">Anyway,
                                                      I guess that that
                                                      issue is not the
                                                      cause of the
                                                      problem.</div>
                                                  </div>
                                                  <div
                                                    class="gmail_extra"><br>
                                                    <div
                                                      class="gmail_quote">El
                                                      23 jun. 2017 1:04
                                                      a. m., "Joel
                                                      Nothman" <<a
                                                        href="mailto:joel.nothman@gmail.com"
                                                        target="_blank"
moz-do-not-send="true">joel.nothman@gmail.com</a>> escribió:<br
                                                        type="attribution">
                                                      <blockquote
                                                        class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid
                                                        rgb(204,204,204);padding-left:1ex">
                                                        <div dir="auto">why
                                                          are you
                                                          passing
                                                          [my_sample_weights]
                                                          rather than
                                                          just
                                                          my_sample_weights?</div>
                                                        <div
                                                          class="gmail_extra">
                                                          <div
                                                          class="gmail_quote"><br>
                                                          </div>
                                                        </div>
                                                      </blockquote>
                                                    </div>
                                                  </div>
                                                </blockquote>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                        <br>
                                        ______________________________<wbr>_________________<br>
                                        scikit-learn mailing list<br>
                                        <a
                                          href="mailto:scikit-learn@python.org"
                                          target="_blank"
                                          moz-do-not-send="true">scikit-learn@python.org</a><br>
                                        <a
                                          href="https://mail.python.org/mailman/listinfo/scikit-learn"
                                          rel="noreferrer"
                                          target="_blank"
                                          moz-do-not-send="true">https://mail.python.org/mailma<wbr>n/listinfo/scikit-learn</a><br>
                                        <br>
                                      </blockquote>
                                    </div>
                                  </div>
                                </div>
                              </blockquote>
                              <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"
                                      moz-do-not-send="true">scikit-learn@python.org</a></span><br>
                                  <span><a
                                      href="https://mail.python.org/mailman/listinfo/scikit-learn"
                                      target="_blank"
                                      moz-do-not-send="true">https://mail.python.org/mailma<wbr>n/listinfo/scikit-learn</a></span><br>
                                </div>
                              </blockquote>
                            </div>
                          </div>
                          <br>
                          ______________________________<wbr>_________________<br>
                          scikit-learn mailing list<br>
                          <a href="mailto:scikit-learn@python.org"
                            target="_blank" moz-do-not-send="true">scikit-learn@python.org</a><br>
                          <a
                            href="https://mail.python.org/mailman/listinfo/scikit-learn"
                            rel="noreferrer" target="_blank"
                            moz-do-not-send="true">https://mail.python.org/mailma<wbr>n/listinfo/scikit-learn</a><br>
                          <br>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            scikit-learn mailing list<br>
            <a href="mailto:scikit-learn@python.org"
              moz-do-not-send="true">scikit-learn@python.org</a><br>
            <a
              href="https://mail.python.org/mailman/listinfo/scikit-learn"
              rel="noreferrer" target="_blank" moz-do-not-send="true">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
scikit-learn mailing list
<a class="moz-txt-link-abbreviated" href="mailto:scikit-learn@python.org">scikit-learn@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/scikit-learn">https://mail.python.org/mailman/listinfo/scikit-learn</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>