[SciPy-Dev] Proposal for some new fitting routines

Christoph Baumgarten christoph.baumgarten at gmail.com
Thu Aug 23 17:36:11 EDT 2018


I have never used these methods, but they look useful and given the links
to stackoverflow etc, there seems to be a certain "demand" for them.

In stats, we have linregress as well as theilslopes (robust regression), i
recently created PR #9101 to add another robust regression technique. so it
could fit there.

On Thu, Aug 23, 2018 at 6:02 PM <scipy-dev-request at python.org> wrote:

> Send SciPy-Dev mailing list submissions to
>         scipy-dev at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/scipy-dev
> or, via email, send a message with subject or body 'help' to
>         scipy-dev-request at python.org
>
> You can reach the person managing the list at
>         scipy-dev-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of SciPy-Dev digest..."
>
>
> Today's Topics:
>
>    1. Re: Proposal for some new fitting routines (Joseph Fox-Rabinovitz)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 22 Aug 2018 13:32:04 -0400
> From: Joseph Fox-Rabinovitz <jfoxrabinovitz at gmail.com>
> To: SciPy Developers List <scipy-dev at python.org>
> Subject: Re: [SciPy-Dev] Proposal for some new fitting routines
> Message-ID:
>         <
> CAAa1KPYoS__fKgb3o+4xt0s+Xn-1DivQSZsD0x-DqraXLFhj3Q at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Tue, Aug 21, 2018 at 11:02 PM <josef.pktd at gmail.com> wrote:
>
> >
> >
> > On Tue, Aug 21, 2018 at 10:12 PM, Joseph Fox-Rabinovitz <
> > jfoxrabinovitz at gmail.com> wrote:
> >
> >> I had sent out an email about a PR proposing an exponential and a power
> >> fit function, but I did not specify the PR number. The PR is #9158.
> >>
> >> Regards,
> >>
> >> - Joe
> >>
> >>
> >> On Mon, Aug 20, 2018, 3:40 PM Joseph Fox-Rabinovitz <
> >> jfoxrabinovitz at gmail.com> wrote:
> >>
> >>> I have added a function for fitting exponential and power curves. This
> >>> seems to
> >>> be a fairly common problem (e.g., see the list of selections from stack
> >>> exchange
> >>> below). The algorithm I have implemented here is objectively better
> than
> >>> the
> >>> common solution of fitting to log(y) because it requires no up-front
> >>> knowledge
> >>> of the intercept, or any other estimations.
> >>>
> >>> Assuming that this PR is acceptable, I would like to get some criticism
> >>> on where
> >>> I chose to put it in the directory structure. My thought was to create
> a
> >>> separate
> >>> module for such common non-iterative optimizations.
> >>>
> >>> I am also unsure of whether my citation of the original work is
> formatted
> >>> properly. I would like to make sure that the author gets the credit and
> >>> publicity they
> >>> deserve. The paper is mentioned (by the author) in answers to [1] and
> >>> [2] below.
> >>>
> >>> List of relevant stack exchange questions:
> >>>
> >>> [1]:
> >>>
> https://stackoverflow.com/questions/3938042/fitting-exponential-decay-with-no-initial-guessing
> >>> [2]:
> >>>
> https://math.stackexchange.com/questions/1337601/fit-exponential-with-constant
> >>> [3]:
> >>>
> https://math.stackexchange.com/questions/350754/fitting-exponential-curve-to-data
> >>> [4]:
> >>>
> https://math.stackexchange.com/questions/1999069/fit-curve-exponential-maybe-to-experimental-data
> >>> [5]:
> >>>
> https://mathematica.stackexchange.com/questions/87645/exponential-fit-to-data-is-of-low-quality
> >>> [6]:
> >>>
> https://stackoverflow.com/questions/48099026/exponential-curve-fit-will-not-fit
> >>> [7]:
> >>>
> https://stackoverflow.com/questions/50683768/exponent-curve-fitting-in-python
> >>> [8]:
> >>>
> https://stackoverflow.com/questions/49565152/curve-fit-an-exponential-decay-function-in-python-using-given-data-points
> >>> [9]:
> >>>
> https://stackoverflow.com/questions/21420792/exponential-curve-fitting-in-scipy
> >>>
> >>> Regards,
> >>>
> >>> - Joe
> >>>
> >>
> >
> > The main question in my opinion is whether scipy should add functions in
> > this area, this area essentially doesn't exist in scipy and is covered,
> for
> > example, by lmfit.
> >
> > Except for the scipy.stats.distribution and the simple linear model,
> there
> > are no fit or estimation methods for specific functions, AFAIK. ODR is
> > related but also doesn't provide specific nonlinear functions
> > scipy.optimize has the optimization algorithm but not specific nonlinear
> > functions that are estimated.
> >
> > lmfit has built in functions for nonlinear estimation
> > https://lmfit.github.io/lmfit-py/builtin_models.html
> > and there some other less well known packages, AFAIR.
> >
> > (There was also a discussion about adding similar predefined functions to
> > statsmodels, but they were never added and for those cases I usually
> refer
> > to lmfit.)
> >
>
> lmfit definitely looks like a good choice to put the functions. On the
> other hand, it offers much more advanced features than just a simple
> regression.
>
> My guess is that, unless there is a clear plan to expand in this area in
> > scipy, then pointing to lmfit would be the better approach.
> > Nevertheless, there could also be demand for having something simple in
> > scipy. E.g. scipy.stats is a bit "eclectic" and has some overlap with
> > statsmodels, or the other way around. scipy.stats has simple linear
> > regression but we never added a full OLS,
> >
>
> On the other hand, the functions I propose are extremely simple, and would
> do well alongside linregress if they were renamed expregress and
> powregress.
>
>
> > multiple linear regression to scipy.stats because there would be too much
> > code duplication especially if there is feature creep and users want
> > similar extended results as statsmodels provides.
> >
> > numpy has polynomial fitting as the only fitting function, AFAIK.
> >
>
> Definitely out of scope for numpy and borderline for scipy.
>
>
> >
> > Josef
> >
> >
> >
> >
> >
> >>
> >> _______________________________________________
> >> SciPy-Dev mailing list
> >> SciPy-Dev at python.org
> >> https://mail.python.org/mailman/listinfo/scipy-dev
> >>
> >>
> > _______________________________________________
> > SciPy-Dev mailing list
> > SciPy-Dev at python.org
> > https://mail.python.org/mailman/listinfo/scipy-dev
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/scipy-dev/attachments/20180822/30022b70/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
>
> ------------------------------
>
> End of SciPy-Dev Digest, Vol 178, Issue 20
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20180823/a38a86a9/attachment.html>


More information about the SciPy-Dev mailing list