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

[contributors wanted] Addition of new PDFs #512

Open
14 of 23 tasks
jonas-eschle opened this issue Mar 1, 2024 · 19 comments
Open
14 of 23 tasks

[contributors wanted] Addition of new PDFs #512

jonas-eschle opened this issue Mar 1, 2024 · 19 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jonas-eschle
Copy link
Contributor

jonas-eschle commented Mar 1, 2024

Fill up the ranks of PDFs with the following. Please feel free to suggest more missing distributions and write in the comments if you want to implement one.

Available:

Implementation finished:

@jonas-eschle jonas-eschle added the enhancement New feature or request label Mar 1, 2024
@ikrommyd
Copy link
Contributor

ikrommyd commented Mar 1, 2024

  • Voigtian
  • Tsallis-Hagedorn, a model for the minimum bias pT distribution
  • Q-Gaussian

@jonas-eschle jonas-eschle added the good first issue Good for newcomers label Mar 1, 2024
@PasqualeAndreola
Copy link

As stated by @iasonkrom , I would be happy to see the Voigtian, too

@anjabeck
Copy link
Contributor

anjabeck commented Mar 7, 2024

Hi! I'd like to make a start on this. Just checking that noone is working on it already?

@ikrommyd
Copy link
Contributor

ikrommyd commented Mar 7, 2024

Hi @anjabeck, I'm doing the Voigt, and I'm also gonna do the CMSShape and CBExGauss because I need them. You can start doing any other distribution if you want. I believe @jonas-eschle is happy to see PRs

@jonas-eschle
Copy link
Contributor Author

Hi @anjabeck , you're very welcome to pick a PDF and start making a PR, I'll update the list

@ikrommyd
Copy link
Contributor

ikrommyd commented Mar 24, 2024

@jonas-eschle I believe q-gaussian is different from the generalized normal? We should also add Student's t distribution which we can do from tensorflow-probability and then the q-gaussian is computed via a change of variables from the t-distribution. I updated the issue.

@ikrommyd
Copy link
Contributor

@anjabeck would you be willing to do some more distributions for tf-probability?

@jonas-eschle
Copy link
Contributor Author

@jonas-eschle I believe q-gaussian is different from the generalized normal? We should also add Student's t distribution which we can do from tensorflow-probability and then the q-gaussian is computed via a change of variables from the t-distribution. I updated the issue.

Agree, it's the student T that we can have to go fro the q-gaussian

@anjabeck
Copy link
Contributor

@anjabeck would you be willing to do some more distributions for tf-probability?

I guess I'd rather try something new to learn stuff :)

@ikrommyd
Copy link
Contributor

ikrommyd commented Mar 26, 2024

@anjabeck would you be willing to do some more distributions for tf-probability?

I guess I'd rather try something new to learn stuff :)

@anjabeck Do you want to take a shot at the Bernstein polynomials?

@ikrommyd
Copy link
Contributor

@jonas-eschle would we want a guassian with different left/right sigmas or should we just leave it like that and a user will have to use the GeneralizedCB with very large fixed alphas? I think a double gaussian makes sense to add for ease of use. It was also part of probfit

@ikrommyd ikrommyd mentioned this issue Mar 28, 2024
8 tasks
@ikrommyd
Copy link
Contributor

ikrommyd commented Mar 29, 2024

@jonas-eschle I also made some progress on Bernstein today. I have a working version on a notebook that gives the same results as numba_stats and RooBernstein but still not "properly" implemented in zfit.

@jonas-eschle jonas-eschle added the help wanted Extra attention is needed label Apr 5, 2024
@jonas-eschle jonas-eschle changed the title Addition of new PDFs [contributors wanted] Addition of new PDFs Apr 5, 2024
@ikrommyd
Copy link
Contributor

Hi @SengerM, we are interested here to add the Landau and LanGauss distribution to zfit. We basically want a tensorflow implementation that is auto-differentiable. As I was looking around, I came accross landaupy and also your scipy PR. As you seem to have done quite some research on this, do you have any recommendations on what approach to follow? I was thinking of following your vectorized numpy implementations and adjusting them to tensorflow (we also can't do in-place replacements in tensorflow tensors).

@SengerM
Copy link

SengerM commented Apr 12, 2024

Hello @ikrommyd , I don't have any specific recommendation as I don't have experience with Tensorflow. I can mention that landaupy and my scipy PR are different implementations:

  • The landaupy implementation, based on the ROOT implementation, does not depend on any specific function, i.e. all the calculations are explicit +, -, * and /, except for some exponentials, logs and sqrts.
  • The scipy PR implementation depends on numpy.polynomial.chebyshev.Chebyshev.

Because of this, it may be easier to follow the more explicit landaupy (ROOT) algorithm.

@ikrommyd
Copy link
Contributor

ikrommyd commented Apr 12, 2024

Thanks for your response @SengerM.
Well my idea was to map your numpy API to tensorflow as they are fairly similar when it comes to vectorized operations.
We also have a Chebyshev polynomial implementation in zfit so I think either could work.
I was wondering if one route is faster and/or better than the other.
We've mapped ROOT code to tensorflow in the past and the workflow is generally in the lines of 1) make all c++ operations vectorized using numpy-like API in tensorflow. 2) all conditions are replaced with tf.where which is similar to np.where.

@mmaehring
Copy link

Hi @ikrommyd, I just wanted to ask if you've started the Landau implementation?
If not, I could give it a shot, though I'm rather inexperienced with tensorflow so I'll probably need some help along the way.

I already started an adaption of the ROOT version sometime ago and would continue from that point. The implementation adapts the ROOT code for the PDF and CDF starting in lines 21 and 336 respectively.

@ikrommyd
Copy link
Contributor

ikrommyd commented Apr 22, 2024

Hi @mmaehring, I haven't started anything that is not done already. Please take a look at the above comments regarding the Landau.

@jonas-eschle
Copy link
Contributor Author

@mmaehring feel free to open a PR in WIP and we can continue a more detailed discussion there, that's probably the easiest

@ikrommyd
Copy link
Contributor

@jonas-eschle Regarding the multivariate normal, I would find anything other than the full covariance matrix version confusing in physics and I agree with scipy only having that version.
I think only that should go in zfit and we can of course use https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/MultivariateNormalFullCovariance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants