[SciPy-user] polyfit problem

Petr Šimon sim at klubko.net
Sat May 5 21:42:16 EDT 2007


On Sunday 06 May 2007 09:37:49 John Hassler wrote:
> You need _at least_ "degree plus one" data points. Consider a quadratic:
> y = a*x**2 + b*x + c
> You would need at least three points to determine the three
> coefficients. Fewer would give an indeterminate problem.
> john
>
Oh, right, thanks a lot (\me hiding)
Petr
> Petr Šimon wrote:
> > Hello,
> > I am learning regression and I was trying to do polyfit with degree
> > higher than the length of data, which failed
> >
> > /usr/lib/python2.4/site-packages/numpy/lib/polynomial.py:305:
> > RankWarning: Polyfit may be poorly conditioned warnings.warn(msg,
> > RankWarning) /usr/lib/python2.4/site-packages/numpy/lib/polynomial.py in
> > polyfit(x, y, deg, rcond, full)
> >     307     # scale returned coefficients
> >     308     if scale != 0 :
> > --> 309         c /= vander([scale], order)[0]
> >     310
> >     311     if full :
> >
> > ValueError: invalid return array shape
> >
> > Is there anyway I can go around this? I am not very strong in linear
> > algebra, so a short explanation or pointer what to read would be of a
> > great help.
> >
> > Thanks a lot
> > Petr
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user



-- 
Petr Šimon 
http://www.klubko.net

PhD student, TIGP-CLCLP Academia Sinica
http://clclp.ling.sinica.edu.tw

"... what the Buddhist call 'right livelyhood', I didn't have that, 
I didn't have any way of making a living, and to make a living 
is to be doing something that you love, something that was creative,
something that made sense..."
		     Mark Bittner, parrot caretaker, Telegraph Hill




More information about the SciPy-User mailing list