add multi gauss fit example
An interesting example for gradient-free-optimization is fitting one or multiple gauss functions to data. The data can be generated with numpy for this example. A "real world" example of this problem is fitting gauss functions to particle-resonances in an energy spectrum. So this example should be very helpful for particle physicists.
Hey, my team and I are interested in helping you out! Correct me if I am wrong, from our understanding you need a function whose input is a dataset and should return the parameters of the Gaussian curves that fit the data. Could you please shed more light on this?
An interesting example for gradient-free-optimization is fitting one or multiple gauss functions to data. The data can be generated with numpy for this example. A "real world" example of this problem is fitting gauss functions to particle-resonances in an energy spectrum. So this example should be very helpful for particle physicists.
Hello @nevinadalal,
thanks for helping out!
from our understanding you need a function whose input is a dataset and should return the parameters of the Gaussian curves that fit the data
That is exactly it. The idea comes from a problem in physics: You have an experiment in which you measured the energy spectrum of the decay products from some emitter (maybe a radioactive sample). The energy spectrum can be shown as a histogram similar to this: researchgate link The type of particle can be identified by fitting gaussian functions to it.
Since I have no experimental data we can instead create it ourself:
samples = np.random.normal(loc=2, scale=3, size=30000)
And later fit a gaussian function to those samples. (This would be a single gaussian fit)
If you are interested you can take this example and develop upon it. You can add multiple peaks in the data (plus an offset of you like) and rewrite it as an hyperactive-example.
Hi SimonBlanke Sorry for the late reply, we have been pretty caught up with some finals. We have made the function for fitting multiple gaussians and would be sending you a pull request tonight. Just wanted to ask how would the function be used in the package? Could you give an example of an optimization algorithm where we could probably link it?
Hope to hear from you soon!
Regards Nevina Dalal Contact: +919769422525 @.***
On Thu, Nov 11, 2021 at 8:08 AM Simon Blanke @.***> wrote:
Hello @nevinadalal https://github.com/nevinadalal,
thanks for helping out!
from our understanding you need a function whose input is a dataset and should return the parameters of the Gaussian curves that fit the data
That is exactly it. The idea comes from a problem in physics: You have an experiment in which you measured the energy spectrum of the decay products from some emitter (maybe a radioactive sample). The energy spectrum can be shown as a histogram similar to this: researchgate link @.***/Particle-identification-spectrum-The-three-oxygen-isotopes-22-O-23-O-and-24-O-were.png> The type of particle can be identified by fitting gaussian functions to it.
Since I have no experimental data we can instead create it ourself: samples = np.random.normal(loc=2, scale=3, size=30000) And later fit a gaussian function to those samples. (This would be a single gaussian fit)
If you are interested you can take this example https://github.com/SimonBlanke/Gradient-Free-Optimizers/blob/master/examples/fit_gaussian.py and develop upon it. You can add multiple peaks in the data (plus an offset of you like) and rewrite it as an hyperactive-example.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/SimonBlanke/Hyperactive/issues/37#issuecomment-966044696, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5BXLQ7YMEQKVD4VLNIWA3ULNTWZANCNFSM5GREC7EQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hi SimonBlanke. This issue looked challenging and interesting, so me and my friends tried to solve it and came up with a solution. We were hoping to share it with you. Let us know if you would be interested. Thanks!
Hello @Vanshikas253,
I am very interested in your solution! :-) if you open a pull-request we can take a look together.