<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">hmm.. guess I can give it a try.. i currently optimizing with for loops..<br class=""><div><blockquote type="cite" class=""><div class="">Den 1. maj 2017 kl. 05.19 skrev Joel Nothman <<a href="mailto:joel.nothman@gmail.com" class="">joel.nothman@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Unless I'm mistaken about what we're looking at, you could use something like:<div class=""><br class=""></div><div class=""><div class="">class ToMultiInput(TransformerMixin, BaseEstimator):</div><div class="">    def fit(self, shapes):</div><div class="">        self.shapes = shapes</div><div class="">    def transform(self, X):</div><div class="">        return [X.]</div><div class=""><br class=""></div><div class="">tmi = ToMultiInput([single.shape for single in train_input])</div><div class=""># this assumes that train_input is a sequence of ndarrays with the same first dimension:</div><div class="">train_input = np.hstack([single.reshape(single.shape[0], -1)</div><div class="">                         for single in train_input])</div><div class=""><br class=""></div><div class="">GridSearchCV(make_pipeline(tmi, my_predictor), ...)</div></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 1 May 2017 at 11:45, Carlton Banks <span dir="ltr" class=""><<a href="mailto:noflaco@gmail.com" target="_blank" class="">noflaco@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">How …  batchsize could also be 1, I’ve just stored it like that.  <div class=""><br class=""></div><div class="">But how do reshape me data to be a matrix.. thats the big question.. is possible?</div><div class=""><div class="h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Den 1. maj 2017 kl. 02.21 skrev Joel Nothman <<a href="mailto:joel.nothman@gmail.com" target="_blank" class="">joel.nothman@gmail.com</a>>:</div><br class="m_-4579478564934195340Apple-interchange-newline"><div class=""><div dir="ltr" class="">Do each of your 33 inputs have a batch of size 100? If you reshape your data so that it all fits in one matrix, and then split it back out into its 33 components as the first transformation in a Pipeline, there should be no problem.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 1 May 2017 at 10:17, Joel Nothman <span dir="ltr" class=""><<a href="mailto:joel.nothman@gmail.com" target="_blank" class="">joel.nothman@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Sorry, I don't know enough about keras and its terminology.<div class=""><br class="">Scikit-learn usually limits itself to datasets where features and targets are a rectangular matrix.</div><div class=""><br class=""></div><div class="">But grid search and other model selection tools should allow data of other shapes as long as they can be indexed on the first axis. You may be best off, however, getting support from the Keras folks.</div></div><div class="m_-4579478564934195340HOEnZb"><div class="m_-4579478564934195340h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On 30 April 2017 at 23:23, Carlton Banks <span dir="ltr" class=""><<a href="mailto:noflaco@gmail.com" target="_blank" class="">noflaco@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">It seems like scikit-learn is not able to handle network with multiple inputs. <div class="">Keras documentation states: </div><div class=""><br class=""></div><div class=""><p style="box-sizing:border-box;line-height:24px;margin:0px 0px 24px;font-size:16px;color:rgb(64,64,64);font-family:Lato,proxima-nova,'Helvetica Neue',Arial,sans-serif" class="">You can use <code style="box-sizing:border-box;font-family:Consolas,'Andale Mono WT','Andale Mono','Lucida Console','Lucida Sans Typewriter','DejaVu Sans Mono','Bitstream Vera Sans Mono','Liberation Mono','Nimbus Mono L',Monaco,'Courier New',Courier,monospace;font-size:14.399999618530273px;white-space:pre-wrap;max-width:100%;background-color:rgb(255,250,250);border:1px solid rgb(225,228,229);padding:0px 5px;color:rgb(158,15,0);overflow-x:auto;word-wrap:break-word;background-position:initial initial;background-repeat:initial initial" class="">Sequential</code> Keras models (<b class="">single-input only</b>) as part of your Scikit-Learn workflow via the wrappers found at <code style="box-sizing:border-box;font-family:Consolas,'Andale Mono WT','Andale Mono','Lucida Console','Lucida Sans Typewriter','DejaVu Sans Mono','Bitstream Vera Sans Mono','Liberation Mono','Nimbus Mono L',Monaco,'Courier New',Courier,monospace;font-size:14.399999618530273px;white-space:pre-wrap;max-width:100%;background-color:rgb(255,250,250);border:1px solid rgb(225,228,229);padding:0px 5px;color:rgb(158,15,0);overflow-x:auto;word-wrap:break-word;background-position:initial initial;background-repeat:initial initial" class=""><a href="http://keras.wrappers.scikit_learn.py/" target="_blank" class="">keras.wrappers.scikit_learn<wbr class="">.py</a></code>.</p><div class="">But besides what the wrapper can do.. can scikit-learn really not handle multiple inputs?.. </div></div><div class=""><div class="m_-4579478564934195340m_6330581331796415802h5"><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Den 30. apr. 2017 kl. 14.18 skrev Carlton Banks <<a href="mailto:noflaco@gmail.com" target="_blank" class="">noflaco@gmail.com</a>>:</div><br class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530Apple-interchange-newline"><div class=""><div style="word-wrap:break-word" class="">The shapes are<div class=""><br class=""></div><div class=""><pre class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530prettyprint m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lang-py m_-4579478564934195340m_6330581331796415802m_-1566019061877626530prettyprinted" style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit" class=""><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530kwd" style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)">print</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> len</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">train_input</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">
</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530kwd" style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)">print</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> train_input</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">[</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">0</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">].</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">shape
</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530kwd" style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)">print</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> train_output</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">.</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">shape

</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">33</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">
</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">100</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">,</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">8</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">,</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">45</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">,</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">3</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">
</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">100</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">,</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">1</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">,</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530lit" style="margin:0px;padding:0px;border:0px;color:rgb(125,39,39)">145</span><span class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span></code></pre><div class=""><br class=""></div><div class="">100 is the batch-size..</div><div class=""><blockquote type="cite" class=""><div class="">Den 30. apr. 2017 kl. 12.57 skrev Joel Nothman <<a href="mailto:joel.nothman@gmail.com" target="_blank" class="">joel.nothman@gmail.com</a>>:</div><br class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530Apple-interchange-newline"><div class=""><div dir="ltr" class="">Scikit-learn should accept a list as X to grid search and index it just fine. So I'm not sure that constraint applies to Grid Search</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 30 April 2017 at 20:11, Julio Antonio Soto de Vicente <span dir="ltr" class=""><<a href="mailto:julio@esbet.es" target="_blank" class="">julio@esbet.es</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class="">Tbh I've never tried, but I would say that te current sklearn API does not support multi-input data...<br class=""></div><div class=""><div class="m_-4579478564934195340m_6330581331796415802m_-1566019061877626530h5"><div class=""><br class="">El 30 abr 2017, a las 12:02, Joel Nothman <<a href="mailto:joel.nothman@gmail.com" target="_blank" class="">joel.nothman@gmail.com</a>> escribió:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">What are the shapes of train_input and train_output?</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 30 April 2017 at 12:59, Carlton Banks <span dir="ltr" class=""><<a href="mailto:noflaco@gmail.com" target="_blank" class="">noflaco@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">I am currently trying to run some gridsearchCV on a keras model which has multiple inputs. <div class="">The inputs is stored in a list in which each entry in the list is a input for a specific channel. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Here is my model and how i use the gridsearch. </div><div class=""><br class=""></div><div class=""><a href="https://pastebin.com/GMKH1L80" target="_blank" class="">https://pastebin.com/GMKH1L80</a></div><div class=""><br class=""></div><div class="">The error i am getting is: </div><div class=""><br class=""></div><div class=""><a href="https://pastebin.com/A3cB0rMv" target="_blank" class="">https://pastebin.com/A3cB0rMv</a></div><div class=""><br class=""></div><div class="">Any idea how i can resolve this?</div><div class=""><br class=""></div><div class=""><br class=""></div></div><br class="">______________________________<wbr class="">_________________<br class="">
scikit-learn mailing list<br class="">
<a href="mailto:scikit-learn@python.org" target="_blank" class="">scikit-learn@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailma<wbr class="">n/listinfo/scikit-learn</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote><blockquote type="cite" class=""><div class=""><span class="">______________________________<wbr class="">_________________</span><br class=""><span class="">scikit-learn mailing list</span><br class=""><span class=""><a href="mailto:scikit-learn@python.org" target="_blank" class="">scikit-learn@python.org</a></span><br class=""><span class=""><a href="https://mail.python.org/mailman/listinfo/scikit-learn" target="_blank" class="">https://mail.python.org/mailma<wbr class="">n/listinfo/scikit-learn</a></span><br class=""></div></blockquote></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
scikit-learn mailing list<br class="">
<a href="mailto:scikit-learn@python.org" target="_blank" class="">scikit-learn@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailma<wbr class="">n/listinfo/scikit-learn</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">scikit-learn mailing list<br class=""><a href="mailto:scikit-learn@python.org" target="_blank" class="">scikit-learn@python.org</a><br class=""><a href="https://mail.python.org/mailman/listinfo/scikit-learn" target="_blank" class="">https://mail.python.org/mailma<wbr class="">n/listinfo/scikit-learn</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
scikit-learn mailing list<br class="">
<a href="mailto:scikit-learn@python.org" target="_blank" class="">scikit-learn@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailma<wbr class="">n/listinfo/scikit-learn</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">scikit-learn mailing list<br class=""><a href="mailto:scikit-learn@python.org" target="_blank" class="">scikit-learn@python.org</a><br class=""><a href="https://mail.python.org/mailman/listinfo/scikit-learn" target="_blank" class="">https://mail.python.org/<wbr class="">mailman/listinfo/scikit-learn</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
scikit-learn mailing list<br class="">
<a href="mailto:scikit-learn@python.org" class="">scikit-learn@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank" class="">https://mail.python.org/<wbr class="">mailman/listinfo/scikit-learn</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">scikit-learn mailing list<br class=""><a href="mailto:scikit-learn@python.org" class="">scikit-learn@python.org</a><br class="">https://mail.python.org/mailman/listinfo/scikit-learn<br class=""></div></blockquote></div><br class=""></body></html>