elvout / cs393r

CS 393R Graduate Autonomous Robots, Fall 2021 | Autobots
0 stars 0 forks source link

Implement resample #44

Closed JieruiLin closed 2 years ago

JieruiLin commented 2 years ago

This PR implements resample and enable updating several times before resample. Move normalization to resample function.

elvout commented 2 years ago

For the last two lines in ParticleFilter::Update,

  // also need to consider gamma
  particle.weight += log_p;

Since we're taking log-likelihoods, gamma becomes a constant coefficient of each term in the summation. My understanding was that since we're renormalizing the log-likelihoods, we don't need the precise absolute value of each log-likelihood – we only need to compare them relative to one another.

I think the last line should be an assignment rather than an addition since we're completely reweighting the particles.

JieruiLin commented 2 years ago

Based on https://docs.google.com/presentation/d/1dSeiL4YbJ0yVgzvhlraW60Nufs04HkocrBpfwZl-RnQ/edit#slide=id.g99b286d0e8_0_971, we need to multiply the likelihood if we resample less often. So, it's addition in log space.

For the last two lines in ParticleFilter::Update,

  // also need to consider gamma
  particle.weight += log_p;

Since we're taking log-likelihoods, gamma becomes a constant coefficient of each term in the summation. My understanding was that since we're renormalizing the log-likelihoods, we don't need the precise absolute value of each log-likelihood – we only need to compare them relative to one another.

I think the last line should be an assignment rather than an addition since we're completely reweighting the particles.

elvout commented 2 years ago

Oh, I see. Thanks for clarifying!