Understanding Metropolis-Hastings algorithm

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • Course link: www.coursera.o...
    Metropolis-Hastings is an algorithm that allows us to sample from a generic probability distribution, which we'll call our target distribution, even if we don't know the normalizing constant. To do this, we construct and sample from a Markov chain whose stationary distribution is the target distribution that we're looking for. It consists of picking an arbitrary starting value and then iteratively accepting or rejecting candidate samples drawn from another distribution, one that is easy to sample. Let's say we want to produce samples from a target distribution. We're going to call it p of theta. But we only know it up to a normalizing constant or up to proportionality. What we have is g of theta. So we don't know the normalizing constant because perhaps this is difficult to integrate. So we only have g of theta to work with. The Metropolis Hastings Algorithm will proceed as follows. The first step is to select an initial value for theta. We're going to call it theta-naught. The next step is for a large number of iterations, so for i from 1 up to some large number m, we're going to repeat the following. The first thing we're going to do is draw a candidate. We'll call that theta-star as our candidate. And we're going to draw this from a proposal distribution. We're going to call the proposal distribution q of theta-star, given the previous iteration's value of theta. We'll take more about this q distribution soon. The next step is to compute the following ratio. We're going to call this alpha. It is this g function evaluated at the candidate divided by the distribution, or the density here of q, evaluated at the candidate given the previous iteration. And all of this will be divided by g evaluated at the old iteration. That divided by q, evaluated at the old iteration. Given the candidate value. If we rearrange this, it'll be g of the candidate times q of the previous value given the candidate divided by g at the previous value. And q evaluated at the candidate, given the previous value.....

Комментарии • 33

  • @nleontis
    @nleontis 4 года назад +11

    How does this guy write backwards?

    • @lucas29476
      @lucas29476 3 года назад +5

      same question. I looked it up and apparently it involves writing on glass in front of camera + flipping the video horizontally.

  • @sethjchandler
    @sethjchandler 2 года назад +6

    Can't believe how good your backwards handwriting is ;)

  • @justinxia9293
    @justinxia9293 4 года назад +8

    This is a pretty nice video thank you so much!!! I feel like I understood a lot of things much better after listening to the video. But there's also homework to prepare for if one wants to fully appreciate the content in the video. One should understand mostly about Bayesian statistics, and terms like normalizing factors. If not, checking around Wikipedia might be a good option.

  • @thefarrellgroup3633
    @thefarrellgroup3633 Год назад +2

    are you writing backwards?! very nice video, thank you for sharing.

  • @khldh
    @khldh 4 года назад +35

    but how did you write in reverse?

    • @frozenburrito9313
      @frozenburrito9313 4 года назад +12

      he didn't, they just reverse the video afterward

    • @purelogic4533
      @purelogic4533 4 года назад +2

      @@frozenburrito9313 that cant be right. What is filmed is a mirror reflection.

    • @frozenburrito9313
      @frozenburrito9313 4 года назад +1

      PureLogic right, that's the correct word

  • @ecapanema
    @ecapanema 3 года назад +3

    Thank you. Great set you got there for presenting it, almost convinced me you're actually left-handed lololol

  • @CW-pe1ci
    @CW-pe1ci 3 года назад

    Nothing more than repeated the Wiki, you didn't specify what's theta_0, how the "draw" candidate, not even one example.

  • @小江-j1i
    @小江-j1i 3 года назад +1

    Where is the next vedio?

  • @freezeandfry
    @freezeandfry 4 года назад +6

    Great video! Still wondering, can you perhaps further explain why the terms that cancel are equal for a normal distribution at 7:21? Can't wait for the next video coming out!

    • @TimBate
      @TimBate 2 года назад +3

      A normal distribution is symmetric about the mean. So, to put some numbers on it, let's say that the proposed theta (theta_star) was one sigma to the right of theta_(i-1). This of course means that theta_(i-1) is one sigma to the left of theta_star. So q(theta_star | theta_(i-1)) is equal to the normal distribution density at +1 sigma. In the divisor, you have q(theta_(i-1) | theta_star) which is equal to the normal distribution density at -1 sigma. But the normal distribution is symmetric about 0, so those values are equal and cancel each other out.

  • @cindyxu1100
    @cindyxu1100 3 года назад +1

    explained everything super clear, thank you

  • @ipuhbamrash6708
    @ipuhbamrash6708 4 года назад +1

    Do you have more video of the tutor??

  • @donpkchannel7203
    @donpkchannel7203 3 года назад

    You miss an example. Without example this looks like science fiction

  • @mohammadghani1379
    @mohammadghani1379 2 года назад

    Dear Professor, what is "q" here?

  • @JohnSmith-lf5xm
    @JohnSmith-lf5xm 4 года назад +1

    I still did not understand. I will wait for the next video. Thank you anyway !

    • @MachineLearningTV
      @MachineLearningTV  4 года назад +5

      Soon we will upload the next video

    • @maximmarchal9991
      @maximmarchal9991 3 года назад +1

      @@MachineLearningTV But when?! Great video by the way.

    • @johannesluttmer1285
      @johannesluttmer1285 3 года назад +1

      @@maximmarchal9991 just look at the movie Metropolis from 1927 or listen to welcome to the machine from pink Floyd and know what's going on. ..this are the bad guys. That's all

  • @jacobmoore8734
    @jacobmoore8734 4 года назад +2

    Could you explain the intuitions behind the formula for alpha?

    • @johannesluttmer1285
      @johannesluttmer1285 3 года назад

      How about totalitair communism? ? Plain in side. .right in front of your 👀

    • @dominicj7977
      @dominicj7977 3 года назад

      Posterior probability of new theta / Posterior probability of old theta.
      You need to understand bayesian statistics for continuous distributions for this.

  • @abdelkarimaths
    @abdelkarimaths 4 года назад

    can we have an example of programming this example on Matlab.

  • @gihanna
    @gihanna 2 года назад

    Brilliant explanation!!! this is the best one

  • @ssvl2204
    @ssvl2204 Год назад

    Very nice and conscise presentation, thanks!

  • @fdsfkdj
    @fdsfkdj 3 года назад

    you got me at the first sentence

  • @calc_5830
    @calc_5830 2 года назад

    where is the next?

  • @smartmarc333
    @smartmarc333 2 года назад

    Just a very good video!

  • @zahrajalilpour9964
    @zahrajalilpour9964 3 года назад

    ١