TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lea – Discrete probability distributions in Python

79 pointsby naftaliharrisover 10 years ago

5 comments

gamegoblinover 10 years ago
A minor grumble, but the filenames are not intuitive at all to me... It makes finding what I&#x27;m looking for a bit difficult.<p><pre><code> alea.py clea.py dlea.py flea.py ilea.py lea.py olea.py plea.py tlea.py </code></pre> Also if anyone is interested in floating point weights, look at the alias method. Good tutorial here: <a href="http://www.keithschwarz.com/darts-dice-coins/" rel="nofollow">http:&#x2F;&#x2F;www.keithschwarz.com&#x2F;darts-dice-coins&#x2F;</a><p>EDIT: User rawnlq beat me to mentioning the alias method. I second the recommendation.
johnloeberover 10 years ago
Oh, that looks <i>nice</i>. This is really great. I worked on a project a while back in which I needed to generate a discrete probability distribution, and found Python&#x27;s support for this to be lacking. I ended up having to hard-code most of the distribution and then use multipliers to cover other cases, which I found very mathematically unsatisfying.<p>Thus, I think Lea looks very helpful for certain use-cases related to discrete probability. Great!
评论 #8582383 未加载
rawnlqover 10 years ago
I was hoping to see an implementation the alias method [1] for sampling from discrete distributions! Nonetheless very cool.<p>[1] <a href="http://en.wikipedia.org/wiki/Alias_method" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Alias_method</a> or <a href="http://www.keithschwarz.com/darts-dice-coins/" rel="nofollow">http:&#x2F;&#x2F;www.keithschwarz.com&#x2F;darts-dice-coins&#x2F;</a>
sinwaveover 10 years ago
I&#x27;m under way on something like this for JavaScript with a buddy of mine. <a href="https://github.com/jacobmenick/sampling/" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jacobmenick&#x2F;sampling&#x2F;</a>
mathgeniusover 10 years ago
The great thing about python is that we all get to implement such a library ourselves, using our own idioms and lack of documentation and&#x2F;or unit tests.
评论 #8584506 未加载