rcond in polyfit

Charles R Harris charlesr.harris at gmail.com
Sat Oct 14 15:28:47 CDT 2006


On 10/13/06, A. M. Archibald <peridot.faceted at gmail.com> wrote:
>
> On 13/10/06, Tim Hochberg <tim.hochberg at ieee.org> wrote:
> > Charles R Harris wrote:


<snip>

> On the other hand if error handling is set to 'raise', then a
> > FloatingPointError is issued. Is a FloatingPointWarning in order to
> > mirror the FloatingPointError? And if so, would it be appropriate to use
> > for condition number?
>
> I submitted a patchto use warnings for several functions in scipy a
> while ago, and the approach I took was to create a ScipyWarning, from
> which more specific warnings were derived (IntegrationWarning, for
> example). That was perhaps a bit short-sighted.
>
> I'd suggest a FloatingPointWarning as a base class, with
> IllConditionedMatrix as a subclass (it should include the condition
> number, but probably not the matrix itself unless it's small, as
> debugging information).
>


Let's pin this down a bit. Numpy seems to need its own warning classes so we
can control the printing of the warnings. For the polyfit function I think
it should *always* warn by default because it is likely to be used
interactively and one can fool around with the degree of the fit. For
instance, I am now scaling the the input x vector so norm_inf(x) == 1 and
this seems to work pretty well for lots of stuff with rcond=-1 (about 1e-16)
and a warning on rank reduction. As long as the rank stays the same things
seem to work ok, up to fits of degree 21 on the test data that started this
conversation.

BTW, how does one turn warnings back on? If I do a

>>> warnings.simplefilter('always', mywarn)

things work fine. Following this by

>>> warnings.simplefilter('once', mywarn)

does what is supposed to do. Once again issuing

>>> warnings.simplefilter('always', mywarn)

fails to have any effect. Resetwarnings doesn't help. Hmmm...

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061014/c372dddc/attachment.html 
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list