Re: [SciPy-Dev] Proposal for some new fitting routines

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@python.org> wrote:
Send SciPy-Dev mailing list submissions to scipy-dev@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@python.org
You can reach the person managing the list at scipy-dev-owner@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@gmail.com> To: SciPy Developers List <scipy-dev@python.org> Subject: Re: [SciPy-Dev] Proposal for some new fitting routines Message-ID: < CAAa1KPYoS__fKgb3o+4xt0s+Xn-1DivQSZsD0x-DqraXLFhj3Q@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
On Tue, Aug 21, 2018 at 11:02 PM <josef.pktd@gmail.com> wrote:
On Tue, Aug 21, 2018 at 10:12 PM, Joseph Fox-Rabinovitz < jfoxrabinovitz@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@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
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
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-n...
[2]:
https://math.stackexchange.com/questions/1337601/fit-exponential-with-consta...
[3]:
https://math.stackexchange.com/questions/350754/fitting-exponential-curve-to...
[4]:
https://math.stackexchange.com/questions/1999069/fit-curve-exponential-maybe...
[5]:
https://mathematica.stackexchange.com/questions/87645/exponential-fit-to-dat...
[6]:
https://stackoverflow.com/questions/48099026/exponential-curve-fit-will-not-...
[7]:
https://stackoverflow.com/questions/50683768/exponent-curve-fitting-in-pytho...
[8]:
https://stackoverflow.com/questions/49565152/curve-fit-an-exponential-decay-...
[9]:
https://stackoverflow.com/questions/21420792/exponential-curve-fitting-in-sc...
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,
than formatted 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@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
participants (1)
-
Christoph Baumgarten