[SciPy-Dev] Return residual and derivative in gradient descent methods like Newton

josef.pktd at gmail.com josef.pktd at gmail.com
Mon Jun 25 10:57:21 EDT 2018


On Mon, Jun 25, 2018 at 10:30 AM, Mark Alexander Mikofski
<mikofski at berkeley.edu> wrote:
> Hi,
>
> Would anyone disagree or would anyone be interested in a proposal to allow
> the derivative to be returned from the user supplied function as an optional
> second argument in gradient search method like Newton? EG
>
>>>> lambda x,a: (x**3-a, 3*x*"2)
>>>> newton(f, x0, fprime='f2', args=(a,))
>
> Some simple tests show that this may have a 2X speed in cases where the
> derivative expression requires the value of the original function call.
>
> See this issue in which I proposed this idea and wore a sample test script
> https://github.com/scipy/scipy/issues/8354
>
> I proposed a way to keep the existing API and add this new feature.
> * If `fprime` is a callable, then same as before
> * If it's a string like "f2" the get fprime from second output

I think using something like a `full_output` option as in the fmin_xxx
function would be more explicit and more flexible.
e.g. the second optional return could be a dict or similar.

Josef


>
> Thanks,
> Mark
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>


More information about the SciPy-Dev mailing list