-
Notifications
You must be signed in to change notification settings - Fork 45
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
Implemented poisson distribution and added in the code files #266
base: develop
Are you sure you want to change the base?
Conversation
This pull request has been mentioned on Discourse — equadratures. There might be relevant details there: https://discourse.equadratures.org/t/google-summer-of-code-2021-projects/108/25 |
Hi @Simardeep27 . Thanks for contributing to the code. Currently, our code features continuous distributions, mostly based on importing from To accommodate this, we need to open up another method in With this said, at the current stage, we cannot merge this PR. However, this is an excellent opportunity for further development. Literature pertaining to "discrete orthogonal polynomials" is sparse, especially with regards to its potential applications. If the case for polynomials orthogonal to discrete measures (such as the Poisson measure) and their applications can be made, it would be a great addition to our code, on top of a contribution to the literature, potentially in the form of a paper. Supposing that you join us for GSoC for the project on universal quadrature rules, I see this as a great potential topic for exploration. Please do let us know about any thoughts and ideas on this. Thanks again for your contribution! |
Hello @ncywong , Thanks again for the guidance |
Hi @Simardeep27, we generally try to follow a workflow like the one described here: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow Essentially this means all new features should be implemented and PR'd into |
P.s. another thought... since the implementation of discrete distributions is likely to require a bit more thought, it might be an idea to implement more continuous distributions first. For example, see the scipy ones below: https://docs.scipy.org/doc/scipy/reference/stats.html Implementing all of the less common ones would be quite tedious and messy. Perhaps a better approach is to add a generic distribution class, where you pass in a user defined scipy distribution object? For example, something that allows us to do: import equadratures as eq
from scipy.stats import truncnorm
mydist = truncnorm(0.1, 2)
myparam = eq.Parameter(order=1, distribution=mydist) This would allow the user to use continuous distributions we haven't added, without requiring us to hard code every single distribution into the code. @ncywong can you foresee any complications with something like this? |
@ascillitoe Not many complications I'd imagine. One thing that came to mind was the need to define the bounds, useful for quadrature rules with endpoints. scipy does not seem to be able to give us that information automatically. |
@Simardeep27 I would recommend starting from the develop branch, and since I think this could be a rather large endeavour, opening up a feature branch would be appropriate. That being said, I'd recommend starting with some continuous distributions as @ascillitoe mentioned, and trying to add the "user-defined" scipy object definition capability. Cheers. |
Sure , I will try to implement this and make a PR. |
Hey @ascillitoe @ncywong, I had a doubt, I was creating a new class for the user defined scipy distributions , When we pass a scipy function to a variable import equadratures as eq
from scipy.stats import truncnorm
mydist = truncnorm(0.1, 2) the variable becomes a 'rv_frozen' and from scipy documentation we could directly call functions for it like , pdf(),cdf(),stats() etc, So would it be feasible to create separate functions for them to call them by our defined class rather than calling them by direct methods defined by scipy. |
Hi @Simardeep27, if I understand you correctly you're saying should we create "wrappers" around the scipy methods The only one that might need a bit more thought is the |
Actually I have created the wrapper functions for I want to ask whether we need just the upper bound and lower bound of the distribution to find |
Hi both, sorry for the late response.
That's what I think too. And as @Simardeep27 correctly mentioned, we can use A further step would be to ensure that the custom recurrence coefficients are doing their job, by verifying that the orthogonal polynomials generated are indeed orthogonal. Basically, for different distributions, try to evaluate the inner product of the polynomial basis functions with respect to the orthogonal probability distribution. Do let me know if you need help on this. |
Hi both, I looked into it a bit more and I think we can get everything we need from @ncywong re the recurrence coefficients, would we just need a bit of logic to decide which method in |
Yes, from what I gathered, we just need to use the |
Hi both, sorry for the late reply P.s. Are there any research papers you could refer for recurrence coefficients, it would help me to get a better understanding of the issue. Thanks |
Hi @Simardeep27, for the plotting additions, would you be able to merge this into the latest Re your work on distributions, sorry for the delay in getting back to you about this, we are still having a think about how we would be able to validate the above for all the different continuous distrubtions scipy offers. Thanks! |
Hey @ascillitoe, sorry for the confusion , I will add it in the different PR. Oh, I will try to find a solution as soon as possible. |
Great thanks! Re validating the distributions, we need to think a bit more about this. If you'd like to have a go at some other stuff in the meantime, there are plenty more plotting utilities that would be useful to implement (e.g. see here), and happy to discuss other ones not yet mentioned on the discourse post! |
Sure, I would keep this on sidelines for the moment. |
This pull request has been mentioned on Discourse — equadratures. There might be relevant details there: https://discourse.equadratures.org/t/triangular-distribution/148/3 |
Implemented poisson distribution as discussed in the issue (#264).
@psesh @ascillitoe it would be helpful if you can look at the implementation of the files and guide me for any further changes to be committed to this file repository.
Changes made in source files :
equadratures.distributions.__init__.py
equadratures.distributions.poisson.py
equadratures.parameters.py
equadratures.tests.test_distributions.py/code>
Thank you for your time.