Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change, but one that I really feel makes
LsqFit
more Julian. Would close #145Instead of
the model definition (the operation which involves the user the most) becomes
i.e. the user doesn't need to think about the shape of
x
, they just define the behavior with respect to a scalar.From the tests, it looks like you are just moving the complexity from the model definition to the data generation
(which goes from
y = model(x, p)
toy = model.(x, Ref(p))
), but note that in real world cases you wouldn't be generating the data from your own model like this.One part that I'm a bit uncertain about is multivariate models: I've currently written it so that the
x
argument forcurve_fit
is aAbstractArray{AbstractArray}
(e.g.[ [1.0, 3.0], [2.0, 3.4], [1.5, 2.0] ]
for a two-variable function with three datapoints). One might want to go through and change this to accept matrices, I just haven't (yet). There are afaict currently no tests for multivariate fitting either.Oh, and the tests weren't passing (some of them even crashed) before, so I relaxed them a bit in the first commit.
Are you interested?