On Fri, Jan 10, 2014 at 9:03 AM, Andreas Hilboll <li...@hilboll.de> wrote:

> Hi,
>
> in using np.polyfit (in version 1.7.1), I ran accross
>
>    TypeError: expected a 1-d array for weights
>
> when trying to fit k polynomials at once (x.shape = (4, ), y.shape = (4,
> 136), w.shape = (4, 136)). Is there any specific reason why this is not
> supported?
>

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.

Chuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to