<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 10, 2014 at 9:03 AM, Andreas Hilboll <span dir="ltr"><<a href="mailto:lists@hilboll.de" target="_blank">lists@hilboll.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
in using np.polyfit (in version 1.7.1), I ran accross<br>
<br>
   TypeError: expected a 1-d array for weights<br>
<br>
when trying to fit k polynomials at once (x.shape = (4, ), y.shape = (4,<br>
136), w.shape = (4, 136)). Is there any specific reason why this is not<br>
supported?<br></blockquote><div><br></div><div>The weights are applied to the rows of the design matrix, so if you have multiple weight vectors you essentially need to iterate the fit over them. Said differently, for each weight vector there is a generalized inverse and if there is a different weight vector for each column of the rhs, then there is a different generalized inverse for each column. You can't just multiply the rhs from the left by *the* inverse. The problem doesn't vectorize.<br>
</div><div><br></div><div>Chuck</div></div><br></div></div>