-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary passing of independent variable to model and curve_fit #149
Comments
I don't understand what you mean. Can you clarify? |
At present, I must define the model to pass to curve fit as:
and then call curve_fit as
However, neither xdata nor ydata are needed by the optimization algorithm. The actual
The definition of |
Oh, okay, yes I see. I agree. I would guess this was originally made so because people have trouble unerstanding closures sometimes, but as I said, I agree. LsqFit will be revamped once Optim has been revamped, so I will keep this issue open to remember this point. Thanks. |
I understand the point here, but it'd probably be nicer for most users to keep the current form, they should not need to know about optimization to use the package. Plus it's the habit that instituted scipy and matlab. |
I do not understand this objection at all, the simplified form requires exactly zero additional knowledge about optimization. Implementation of the the old interface in terms of the new one is literally one line:
|
Let me break it down:
|
"Other packages", meaning MATLAB, use the verbose form because that language does not have closures. There's no reason to keep legacy crud in a better language. (And btw, it's not really accurate to say that scipy and MATLAB use the same form.
That is an assertion not backed by any argument. Interface with fewer parameters is clearly easier to understand.
The reverse is not really true, because in addition you need to add a whole lot of unnecessary argument passing within |
FWIW I'm coming here from Matlab and looking for a |
Optimization routine curve_fit() and function model() that should be supplied to it both require a user to pass the independent variable "xdata". Yet the optimization algorithm makes no use of it, other than passing to model().
This looks like unnecessary clutter. Why not omit this argument from both the model and optimization functions, supplying it through closure to the model (and Jacobian, if used)?
The text was updated successfully, but these errors were encountered: