Skip to content
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

Fitting namespace #1979

Open
RobBuchananCompPhys opened this issue Sep 27, 2024 · 3 comments
Open

Fitting namespace #1979

RobBuchananCompPhys opened this issue Sep 27, 2024 · 3 comments
Assignees
Labels
Scope: Design Related to fundamental code design, algorithm use etc. Type: Enhancement Enhancement for existing feature

Comments

@RobBuchananCompPhys
Copy link
Contributor

RobBuchananCompPhys commented Sep 27, 2024

Describe the feature / issue
Namespace DissolveFit will contain basic fitting operations for 1D data. This originally started as a motivation to include a go-to method for a general case of fitting a Gaussian to histogram data, but the scope expanded to peak finding - a class for this has now been implemented (#1978 ), although the Gaussian fit has yet to be implemented.

Additional details
I thought given the arrival of the first PR, we could maybe flesh out exactly what else should go into this namespace in terms of classes or methods that would be good to have in there.
Some ideas from my side:

  • Linear and non-linear polynomial Regression class (i.e. for order-N polynomial fitting, perhaps powered by least-squares by gradient descent)
  • an Approximation class to implement a range of user-specified mathematical series to approximate data, such as Taylor, exponential, or power series.
  • a Parametric enum class to specify explicitly functional forms to be fitted to data, such as Gaussian, asymmetric peak, logistic function etc. with the fitting also to be handled by the above Approximation class
  • Sparse fitting functionality, for instance to model complex data with more simple delta functions
  • A collection of useful minimisation algorithms that could be used in conjunction with the above classes. I think it would be great to have gradient descent in there, but also some global optimization methods such as genetic algorithm or simulated annealing for when there are many parameters to be fitted. This bit could maybe even reside in a neighbouring namespace (i.e. DissolveMinimise), and the idea is that any of the fitting classes described above that can use minimisation schemes to converge could make use of these minimisers interchangeably, making them akin to a sort of 'plugin'.
@RobBuchananCompPhys RobBuchananCompPhys added the Type: Enhancement Enhancement for existing feature label Sep 27, 2024
@RobBuchananCompPhys RobBuchananCompPhys self-assigned this Sep 27, 2024
@RobBuchananCompPhys
Copy link
Contributor Author

@rprospero @trisyoungs

@RobBuchananCompPhys RobBuchananCompPhys linked a pull request Sep 27, 2024 that will close this issue
@RobBuchananCompPhys RobBuchananCompPhys removed a link to a pull request Sep 27, 2024
@rprospero
Copy link
Contributor

If we're going to be adding a large number of these fitting functions, I'm beginning to wonder if we might be better off using pre-existing library for these functions. For example, GSL provides most of the fitting and polynomial functionality that we might desire. It's available on Conan, so it shouldn't be more onerous than other dependencies that we already include. Honestly, I'm rather hoping that we could find a better library than GSL, but it serves as an example.

@RobBuchananCompPhys
Copy link
Contributor Author

RobBuchananCompPhys commented Sep 27, 2024

I'm currently looking into how applicable the GSL library is for covering this functionality - I imagine it will be very applicable though. My guess is that as a first course of action, we could remove my peak finding work from the DissolveFit namespace, and place it in its own namespace, Peaks. Then the fitting namespace could be a wrapper to GSL functions.

@trisyoungs trisyoungs added the Scope: Design Related to fundamental code design, algorithm use etc. label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Design Related to fundamental code design, algorithm use etc. Type: Enhancement Enhancement for existing feature
Projects
None yet
Development

No branches or pull requests

3 participants