[SciPy-User] Issue with SciPy opmize fmin_cg

Robert Kern robert.kern@gmail....
Tue Jul 31 14:18:03 CDT 2012


On Tue, Jul 31, 2012 at 12:53 PM, The Helmbolds <helmrp@yahoo.com> wrote:
> I think you are right. I'm using a 64-bit machine with Windows operating
> system, but Python and SciPy are in my 32-bit programs folder.

The 64-bitness of your machine or the 32-bitness of your Python has
nothing to do with the size of your floats. Those only refer to the
address space (the size of pointers). You will have to check your
code. Do you explicitly use numpy.float32 arrays?

> Message: 3
> Date: Sun, 29 Jul 2012 20:01:25 -0500
> From: Aronne Merrelli <aronne.merrelli@gmail.com>
> Subject: Re: [SciPy-User] Optimize fmin_cg issue
> To: SciPy Users List <scipy-user@scipy.org>
> I get the same result, but I get a very similar NaN result as the OP
> if I try with a point farther from zero (try [100,150] instead of
> [10,15]). That suggests this is a 32bit vs 64bit float overflow issue
> - perhaps OP is using 32 bit and we are using 64 bit floats. So, I
> doubt the algorithm has a bug per se, but the output message could be
> improved.
>
> I'm not an expert at this part of SciPy, but my guess is that the
> iteration loop just isn't checking for NaN values to determine the
> "success" of the iterative loop. Looking inside fmin_cg in optimize.py
> (moved to _minimize_cg() in the current github), I think what might be
> happening is that the gnorm variable is NaN, and then this causes the
> while loop to terminate since the while loop's conditional is (gnorm >
> gtol), and that will be false. So the later code just sees an exit of
> the while loop well short of the iteration maximum, and it only checks
> the iteration limit and step size (alpha_k) to determine "success".
>
> [1] https://github.com/scipy/scipy/blob/master/scipy/optimize/optimize.py
>
> Cheers,
> Aronne
>
>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



-- 
Robert Kern


More information about the SciPy-User mailing list