Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-28 Thread Pontus Stenetorp
Thanks a bundle everyone, I could not have hoped for a better set of answers. The Darts, Dice, and Coins page is excellent, the original papers are also very accessible, something that I have experienced with a lot of early Computer Science papers. In case anyone is interested in where Vose's

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-27 Thread Sebastian Nowozin
Hi Jason, great answer, I learned something useful today :-) Sebastian On Wed, May 27, 2015 at 4:07 PM, Jason Merrill jwmerr...@gmail.com wrote: You might want to take a look at http://en.m.wikipedia.org/wiki/Alias_method There's a nice, detailed exposition at

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-27 Thread Jason Merrill
You might want to take a look at http://en.m.wikipedia.org/wiki/Alias_method There's a nice, detailed exposition at http://www.keithschwarz.com/darts-dice-coins/

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-27 Thread Simon Byrne
In fact, it's already implemented in Distributions.jl: julia c = Categorical([0.1,0.2,0.3,0.4]) Categorical(K=4, p=[0.1,0.2,0.3,0.4]) julia a = sampler(c) AliasTable with 4 entries julia rand(a) 4 On Wednesday, 27 May 2015 17:24:55 UTC+1, Sebastian Nowozin wrote: Hi Jason, great answer,

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-27 Thread David P. Sanders
El miércoles, 27 de mayo de 2015, 18:24:55 (UTC+2), Sebastian Nowozin escribió: Hi Jason, great answer, I learned something useful today :-) I second that! But I'm also very happy to see that the Julian experts already knew all about it! David. Sebastian On Wed, May 27, 2015 at

[julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-26 Thread David P. Sanders
El miércoles, 27 de mayo de 2015, 0:27:41 (UTC+2), Sebastian Nowozin escribió: Hi Pontus, I have not seen this approach before, but it is certainly interesting and potentially useful. I hadn't seen it either, and it is nice, yes. As far as I am aware, the standard method for

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-26 Thread Jameson Nash
since this looks a lot like recreating a distribution from a frequency measurement, one of the other tools that comes to my mind (courtesy of an old question I asked of julia-users in the development of the hist method in base), is to compute the (continuous) Kernel Density Estimator first, and

[julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-26 Thread Sebastian Nowozin
Hi Pontus, I have not seen this approach before, but it is certainly interesting and potentially useful. Without giving an answer to your questions, some things to consider: 1. Small probabilities will be the hardest to represent. 2. Maybe there is an exact method possible by storing in each