+ Reply to Thread
Results 1 to 4 of 4

Thread: Sampling from a distribution

  1. #1
    Points: 101, Level: 2
    Level completed: 2%, Points required for next Level: 49

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sampling from a distribution




    Assume I have a distribution governing the possible outcome from a single random variable X. This is something like [0.1, 0.4, 0.2, 0.3] for X being a value of either 1, 2, 3, 4.

    Is it possible to sample from this distribution, i.e. generate pseudo random numbers upon each of the possible outcomes given the probability of that outcome. So if I wanted to know what the probability of getting a 2 is, the sampling operation may return 0.34 or something like that.

    The reason I ask is that I'm trying to implement an action selection policy for a reinforcement learning method based on a research paper. From what I gather from the paper, the author is able to sample the distribution by "mapping the uniform distribution U[0,1] through cumulative probability density functions obtained by adaptive numerical integration". From this he then samples the transition probabilities for each trial...

    I would be grateful for any info on this...

    Thanks in advance

  2. #2
    Devorador de queso
    Points: 95,781, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,933
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Sampling from a distribution

    If all you are asking about is if it's possible to obtain a random sample from an arbitrary discrete distribution - the answer is yes and it is quite easy to do if you have access to a random sample from a uniform distribution. However the following confused me because .34 isn't one of your specified outcomes or a probability you specified. I'm guessing it's unrelated to your original example but I'm still a little confused about what you're asking here.

    Quote Originally Posted by seabaz2000 View Post
    Is it possible to sample from this distribution, i.e. generate pseudo random numbers upon each of the possible outcomes given the probability of that outcome. So if I wanted to know what the probability of getting a 2 is, the sampling operation may return 0.34 or something like that.
    I don't have emotions and sometimes that makes me very sad.

  3. #3
    Points: 101, Level: 2
    Level completed: 2%, Points required for next Level: 49

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sampling from a distribution

    Hi Dason,
    Thanks for the reply, I think I have phrased it wrong and I think the terminology from the paper is throwing me.

    If I plot a CDF using this distribution, then generate a uniform random number u [0,1].
    Then if u<0.1 I output 1, if its between 0.1 and 0.5 I output 2 and so on. Would this be correct.

    Thanks in advance

  4. #4
    Devorador de queso
    Points: 95,781, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,933
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Sampling from a distribution


    Quote Originally Posted by seabaz2000 View Post
    Then if u<0.1 I output 1, if its between 0.1 and 0.5 I output 2 and so on. Would this be correct.
    Yup - that's basically it.
    I don't have emotions and sometimes that makes me very sad.

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats