<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div>Hi Tirth,<div><br></div><div>great to hear that you are interested in the project! My main goal would be to add the "universal" rv generation methods to SciPy, e.g. PINV, TDR (<a href="http://statmath.wu.ac.at/software/unuran/doc/unuran.html#Methods_005ffor_005fCONT">UNU.RAN User Manual (wu.ac.at)</a>). At the moment, we just have one such function in SciPy (<a href="https://docs.scipy.org/doc/scipy/reference/stats.html#random-variate-generation">Statistical functions (scipy.stats) — SciPy v1.6.2 Reference Guide</a>) and it is very basic (I implemented it a while ago). Such functionality is very useful in many situations, see e.g. <a href="https://github.com/scipy/scipy/issues/13051">OverflowError when sampling from some handmade stats distributions · Issue #13051 · scipy/scipy (github.com)</a> So the API would rather be name_of_sampling_method(pdf / cdf, parameters of the sampling methods).</div><div><br></div><div>Whether one should add a keyword to distribution.rvs(...) that allows the user to choose the sampling method might be a question for a follow-up project. This would also be quite time-consuming since you need to verify which method is appropriate for a given distribution. A simpler task could be to check if the rvs methods of a specific distribution could be overwritten with the corresponding method in UNU.RAN (<a href="http://statmath.wu.ac.at/software/unuran/doc/unuran.html#Stddist">UNU.RAN User Manual (wu.ac.at)</a>). For example, geninvgauss in SciPy relies on a Python implementation of a rejection method / RoU and the implementation in UNU.RAN (gig / gig2) might be faster. Also distributions with slow ppf methods relying on special functions would be natural candidates. But that would also be of lower priority for me.</div><div><br></div><div>I hope it helps. Feel free to reach out if you have more questions.<br></div><div><br></div><div>Christoph</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at 6:00 PM <<a href="mailto:scipy-dev-request@python.org">scipy-dev-request@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send SciPy-Dev mailing list submissions to<br>
        <a href="mailto:scipy-dev@python.org" target="_blank">scipy-dev@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scipy-dev</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:scipy-dev-request@python.org" target="_blank">scipy-dev-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:scipy-dev-owner@python.org" target="_blank">scipy-dev-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of SciPy-Dev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Multivariate non-central hypergeometric distributions<br>
      (Wallenius' and Fisher's) (???? ?????????)<br>
   2. GSoC: Integrate library UNU.RAN into scipy.stats (Tirth Patel)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 2 Apr 2021 00:05:10 +0200<br>
From: ???? ????????? <<a href="mailto:samogot@gmail.com" target="_blank">samogot@gmail.com</a>><br>
To: <a href="mailto:scipy-dev@python.org" target="_blank">scipy-dev@python.org</a><br>
Subject: [SciPy-Dev] Multivariate non-central hypergeometric<br>
        distributions (Wallenius' and Fisher's)<br>
Message-ID:<br>
        <<a href="mailto:CAMJZOa0xemJR7WCjcMcEyGUKvqMqPF6YDtLxbb%2Br2e4d1k-HDA@mail.gmail.com" target="_blank">CAMJZOa0xemJR7WCjcMcEyGUKvqMqPF6YDtLxbb+r2e4d1k-HDA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi everyone.<br>
<br>
Univariate versions of non-central hypergeometric distributions based<br>
on Agner Fog's BiasedUrn C++ code were added recently (in<br>
<a href="https://github.com/scipy/scipy/pull/13330" rel="noreferrer" target="_blank">https://github.com/scipy/scipy/pull/13330</a>). C++ code added in that PR<br>
already contains the implementation of multivariate versions of the same<br>
distributions. As far as I understand, the only things needed for<br>
multivariate distributions to work are Python wrapper and probably some<br>
tests.<br>
<br>
Is anyone interested in adding them? If not, I might get to it myself later<br>
this month, but as I haven't made any scipy contributions yet and am not<br>
familiar with the codebase, I will need much more time to rump up than an<br>
experienced contributor :)<br>
<br>
--<br>
Regards,<br>
Ivan Naydonov<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://mail.python.org/pipermail/scipy-dev/attachments/20210402/455ec86f/attachment-0001.html" rel="noreferrer" target="_blank">https://mail.python.org/pipermail/scipy-dev/attachments/20210402/455ec86f/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 2 Apr 2021 19:19:26 +0530<br>
From: Tirth Patel <<a href="mailto:tirthasheshpatel@gmail.com" target="_blank">tirthasheshpatel@gmail.com</a>><br>
To: scipy-dev <<a href="mailto:scipy-dev@python.org" target="_blank">scipy-dev@python.org</a>><br>
Subject: [SciPy-Dev] GSoC: Integrate library UNU.RAN into scipy.stats<br>
Message-ID:<br>
        <CABpuv38XtcJWOT6kskF_Rv3T=_<a href="mailto:0iSoNCVr7gtnupL0kGQixfWg@mail.gmail.com" target="_blank">0iSoNCVr7gtnupL0kGQixfWg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="UTF-8"<br>
<br>
Hi all,<br>
<br>
I would like to participate in GSoC this year and found this project<br>
very interesting!<br>
<br>
TL; DR: I have a few questions regarding the project:<br>
  - Is the user interface desired as a separate python submodule<br>
(inside `scipy.stats`) or does it serve as an extension of the `rvs`<br>
method?<br>
  - Should UNU.RAN C library be included as a submodule within SciPy<br>
(e.g. gh-12043) or be cloned from a separate GitHub submodule (e.g<br>
gh-13328)?<br>
<br>
About Me<br>
********<br>
I am Tirth (@tirthasheshpatel on GitHub), a third-year computer<br>
science undergrad student. I am quite familiar with Cython and a lot<br>
of my college courses make use of C. I have a good knowledge of<br>
probability theory and statistics.<br>
<br>
Open Source work: I have participated in GSoC with the PyMC team last<br>
year. I am a contributor to SciPy since May 2020 and recently a<br>
maintainer.<br>
<br>
About Project<br>
*************<br>
I had a question about the project. Is the user interface desired as a<br>
separate python submodule inside `scipy.stats`? like:<br>
<br>
    import scipy.stats as stats<br>
<br>
    # sample a 1000 variates from a normal distribution<br>
    # with mean 0 and std 1.5. Let UNU.RAN choose the method<br>
    rvs = stats.random.normal(0., 1.5, size=1000, method='auto')<br>
<br>
    # sample 100 samples from the beta distribution using TDR method<br>
    beta_rvs = stats.random.beta(1, 2, size=100, method='tdr')<br>
<br>
    # the `rvs` methods remains unaffected.<br>
    norm_rvs = stats.norm.rvs(0, 1.5, size=1000)<br>
<br>
Or does it serve as an extension of the `rvs` method:<br>
<br>
    from scipy.stats import norm, beta<br>
<br>
    # something like this:<br>
    # method = None => same behaviour as previous versions<br>
    # method = 'auto' => use UNU.RAN and let it choose the method<br>
    rvs = norm.rvs(0, 1.5, size=1000, method='auto')<br>
<br>
    beta_rvs = beta.rvs(1, 2, size=100, method='tdr')<br>
<br>
Also, should UNU.RAN C library be included as a submodule within SciPy<br>
(e.g. gh-12043) or be cloned from a separate GitHub submodule (e.g<br>
gh-13328)?<br>
<br>
<br>
--<br>
Kind Regards,<br>
Tirth<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org" target="_blank">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scipy-dev</a><br>
<br>
<br>
------------------------------<br>
<br>
End of SciPy-Dev Digest, Vol 210, Issue 2<br>
*****************************************<br>
</blockquote></div></div></div></div></div></div></div></div>