σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Particle filtering and non-stationary time series skill›Module 2 · Particle filters›Topic 2.3·~55 minAdvanced

Resampling schemes and degeneracy

Skill positionModule 2 of 3 · Topic 3 of 5
2.3 Resampling schemes and degeneracy
—Lab score— / 100Total XP—Streak—

When the weights collapse

Weights multiply from day to day. A particle that explains a few observations badly gets a tiny weight, and tiny weights never recover. After enough days one particle carries nearly all the weight and the rest are wasted work. This is weight degeneracy, and the effective sample size 1/∑w~21/\sum\tilde w^{2}1/∑w~2 measures it. On SPY with 100010001000 particles and no resampling, the effective sample size is 960960960 after the first day, 368368368 after ten, 525252 after fifty, and about 1.31.31.3 after 250250250 days. A filter that has collapsed to one particle is a single guess, not a cloud.

ESS=1∑iw~i2,ESS<N2,u+iN,  i=0,…,N−1\mathrm{ESS}=\frac{1}{\sum_i\tilde w_i^{2}},\qquad \mathrm{ESS}<\frac N2,\qquad \frac{u+i}{N},\ \ i=0,\dots,N-1ESS=∑i​w~i2​1​,ESS<2N​,Nu+i​,  i=0,…,N−1(1)

Resampling cures degeneracy: draw a new cloud of NNN particles in which a particle with weight w~i\tilde w_iw~i​ is expected to appear Nw~iN\tilde w_iNw~i​ times, then give every copy the same weight 1/N1/N1/N. There are several ways to do the draw. Multinomial resampling draws NNN independent uniform numbers. Systematic resampling draws one uniform uuu and uses NNN evenly spaced pointers (u+i)/N(u+i)/N(u+i)/N on the cumulative weights. Stratified resampling draws one uniform in each of the NNN equal slices. Residual resampling first gives every particle its whole copies, ⌊Nw~i⌋\lfloor N\tilde w_i\rfloor⌊Nw~i​⌋, and draws only the leftover. Systematic is the cheapest and the most used.

Systematic resampling by handTake four particles at −1,0,1,2-1,0,1,2−1,0,1,2 with weights 0.058, 0.258, 0.426, 0.2580.058,\ 0.258,\ 0.426,\ 0.2580.058, 0.258, 0.426, 0.258. The cumulative weights are 0.058, 0.316, 0.742, 10.058,\ 0.316,\ 0.742,\ 10.058, 0.316, 0.742, 1. Draw u=0.3u=0.3u=0.3. The pointers are (0.3+i)/4=0.075, 0.325, 0.575, 0.825(0.3+i)/4=0.075,\ 0.325,\ 0.575,\ 0.825(0.3+i)/4=0.075, 0.325, 0.575, 0.825. Pointer 0.0750.0750.075 falls in the second slot, 0.3250.3250.325 and 0.5750.5750.575 in the third, 0.8250.8250.825 in the fourth. The new cloud is 0,1,1,20,1,1,20,1,1,2: the particle at −1-1−1 is gone and the heavy one at 111 is copied twice, close to its expected 4×0.426=1.74\times0.426=1.74×0.426=1.7 copies. Danger case: with weights 0.97, 0.01, 0.01, 0.010.97,\ 0.01,\ 0.01,\ 0.010.97, 0.01, 0.01, 0.01 the effective sample size is 1.061.061.06, and any pointer set picks only the first particle, so the cloud collapses to one distinct value.
  • Resample when the ESS is low: a common rule is ESS<N/2\mathrm{ESS}<N/2ESS<N/2. Resampling every day wastes diversity.
  • Systematic uses one random number: pointers (u+i)/N(u+i)/N(u+i)/N on the cumulative weights give a cheap, low-noise draw.
  • The price is impoverishment: many copies of a few particles leave the cloud with little variety, which the next propagation step must rebuild.

Lab · what's graded

  • Expected copies15 pts
  • A systematic pointer10 pts
  • Collapsed weights15 pts
  • Distinct survivors10 pts
  • Should we resample today10 pts
  • Systematic resampling10 pts
  • Match the schemes15 pts
  • Why resample at all15 pts
0/ 8 answered
Tasks
1Numeric answer15 ptsNot answered

With N=4N=4N=4 particles, a particle with normalised weight 0.4260.4260.426 is expected to appear Nw~N\tilde wNw~ times after resampling. What is that number? Give two decimals.

n=n =n=accepted: ± 0.02
2Numeric answer10 ptsNot answered

Systematic resampling with N=4N=4N=4 and u=0.3u=0.3u=0.3 uses pointers (u+i)/N(u+i)/N(u+i)/N. What is the second pointer, i=1i=1i=1? Give three decimals.

p=p =p=accepted: ± 0.001
3Numeric answer15 ptsNot answered

The normalised weights are 0.97, 0.01, 0.01, 0.010.97,\ 0.01,\ 0.01,\ 0.010.97, 0.01, 0.01, 0.01. What is the effective sample size 1/∑w~21/\sum\tilde w^{2}1/∑w~2? Give two decimals.

ess=ess =ess=accepted: ± 0.01
4Numeric answer10 ptsNot answered

The weights are 0.97, 0.01, 0.01, 0.010.97,\ 0.01,\ 0.01,\ 0.010.97, 0.01, 0.01, 0.01 and systematic resampling uses N=4N=4N=4 pointers with u=0.5u=0.5u=0.5. How many different original particles appear in the new cloud?

k=k =k=accepted: ± 0.01
5Choice10 ptsNot answered

There are N=1000N=1000N=1000 particles and the effective sample size today is 620620620. Using the rule "resample when ESS < N/2", what do you do?

6Order the steps10 ptsNot answered

Put the steps of systematic resampling in order.

Drag to reorder, or focus an item, press Space to lift it, the arrow keys to move it and Space to drop it.

  1. 1For each pointer take the first particle whose cumulative weight reaches it
  2. 2Add up the weights into cumulative weights
  3. 3Place N evenly spaced pointers (u + i) / N
  4. 4Draw one uniform number u
  5. 5Give every copy the weight 1 / N
7Match15 ptsNot answered

Match each resampling scheme with how it draws.

Pick the partner of each item on the left.

Multinomial
Systematic
Stratified
Residual
8Explain in words15 ptsNot answered

In one or two sentences, explain why a particle filter needs resampling and what it costs.

Math modeKeyboard or LaTeX inputTask 1 of 8 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub