Documentation

MetropolizedBackwardSampling.PreviousState.AncestorSampling

CSMC with ancestor sampling of the reference #

Given the reference trajectory x_{1:T}, resampling schemes r_t, and kernels K_T and K_{t,j,j'} which are functions of the particle positions and of the ancestor indices, Algorithm S1 of the supplementary material consists of the following steps.

(a) Draw b_1 uniformly on [N], set x_1^{b_1} = x_1, and draw x_1^i ∼ m_1 for i ≠ b_1. (b) For t = 1, …, T - 1, draw c ∼ B_t(·|x_{t+1}), and then (b_{t+1}, a_t) with probabilities proportional to r_t(a_t) on the set where a_t^{b_{t+1}} = c. Set x_{t+1}^{b_{t+1}} = x_{t+1} and draw x_{t+1}^i ∼ m_{t+1}(x_t^{a_t^i}, ·) for i ≠ b_{t+1}. (c) Run steps (c) to (e) of Algorithm 1.

In Lemma S1, c may also be drawn in Algorithm S1.b from the kernel K_{t,j,j} of one of the six selection rules, with B_t(·|x_{t+1}) in place of B_t(·|j), started from b_t. In the forward pass forwardPass r C, c is drawn from C(B_t(·|x_{t+1}))(b_t, ·), for a function C from probability vectors to kernels. With the Gibbs kernel, this is Algorithm S1.b itself.

The density (S4) of the particle positions, the ancestor indices, and the indices of the reference is also defined here, together with the distribution with this density.

Three results are proved here. The first is the pointwise identity of the proof of Lemma S1 (target_mul_fwdDensity_eq_extDensity): if each C(p) is reversible with respect to p, as are the kernels K_{t,j,j} of the six selection rules, the density of x_{1:T} ∼ π followed by steps (a) and (b) of Algorithm S1 is the density (S4). The second is that the forward pass is a Markov kernel (isMarkovKernel_forwardPass), which is proved by integrating out the particles and summing over the indices backwards in time. The third is the measurability of the kernels of the selection rules in the particle positions and the ancestor indices.

theorem CSMC.PreviousState.sum_filter_forall_eq_sum_sum_update {ι : Type u_2} {α : Type u_3} {R : Type u_4} [Fintype ι] [DecidableEq ι] [Fintype α] [DecidableEq α] [AddCommMonoid R] {P Q : ι → Prop} [DecidablePred P] [DecidablePred Q] {i : ι} (hi : P i) (hPQ : ∀ (t : ι), Q t ↔ t ≠ i ∧ P t) (g : ι → α) (f : (ι → α) → R) :
∑ b : ι → α with ∀ (t : ι), Q t → b t = g t, f b = ∑ b : ι → α with ∀ (t : ι), P t → b t = g t, ∑ j : α, f (Function.update b i j)

Summing over the functions b which agree with g at the indices t with Q t amounts to summing over those which agree with g at the indices t with P t, and over the value at i, when the indices t with Q t are those other than i with P t.

theorem CSMC.PreviousState.sum_lmarginal_mul_eq {δ : Type u_2} {ι : Type u_3} {Y : δ → Type u_4} [(i : δ) → MeasurableSpace (Y i)] {μ : (i : δ) → MeasureTheory.Measure (Y i)} [DecidableEq δ] (s : Finset δ) (I : Finset ι) {f : ((i : δ) → Y i) → ENNReal} {g : ι → ((i : δ) → Y i) → ENNReal} (hf : Measurable f) (hg : ∀ j ∈ I, Measurable (g j)) (x : (i : δ) → Y i) (h : ∀ (z : (i : ↥s) → Y ↑i), ∑ j ∈ I, g j (Function.updateFinset x s z) = 1) :
∑ j ∈ I, (∫⋯∫⁻_s, fun (y : (i : δ) → Y i) => f y * g j y ∂μ) x = (∫⋯∫⁻_s, f ∂μ) x

If the functions g j, j ∈ I, sum to one at the points which agree with x outside s, the sum over j ∈ I of the marginal integrals over s of the products f * g j at x is the marginal integral of f at x.

theorem CSMC.PreviousState.IsUnbiasedResampling.sum_sum_toNNReal_div_eq_one {X : Type u_1} {N : ℕ} {r : (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hr : IsUnbiasedResampling r) (xs : Fin N → X) {w : Fin N → ℝ} (hw : IsProbVector w) (hwpos : ∀ (i : Fin N), 0 < w i) {K : Matrix (Fin N) (Fin N) ℝ} (hK : K ∈ Matrix.rowStochastic ℝ (Fin N)) (β : Fin N) :
∑ j : Fin N, ∑ a : Fin N → Fin N, (K β (a j) * r xs w a / ∑ b' : Fin N, ∑ a' : Fin N → Fin N, if a' b' = a j then r xs w a' else 0).toNNReal = 1

Under the condition of Definition S1, with positive weights w and a row-stochastic matrix K, the probabilities K(β, a^j) r(a) / ∑_{(b', a') : a'^{b'} = a^j} r(a') of the pairs (j, a) sum to one.

noncomputable def CSMC.PreviousState.Model.fwdDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ) (b : Idx n N) (y : Pos X n N) (a : Anc n N) :

The density of steps (a) and (b) of Algorithm S1 at the particle positions y and the ancestor indices a, given the indices b of the reference, when c is drawn from C(B_t(·|x_{t+1}))(b_t, ·): the product of 1/N, of m_1(x_1^i) for i ≠ b_1, and, for t ∈ [T - 1] and c_t = a_t^{b_{t+1}}, of C(B_t(·|b_{t+1}))(b_t, c_t), of r_t(a_t) divided by the sum of r_t(a') over the pairs (b', a') with a'^{b'} = c_t, and of m_{t+1}(x_t^{a_t^i}, x_{t+1}^i) for i ≠ b_{t+1}.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    noncomputable def CSMC.PreviousState.Model.forwardPass {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ) :
    ProbabilityTheory.Kernel (Traj X n) (Pos X n N × Anc n N × Idx n N)

    Steps (a) and (b) of Algorithm S1, with c drawn from C(B_t(·|x_{t+1}))(b_t, ·), as a kernel from the reference trajectory to the particle positions, the ancestor indices, and the indices of the reference.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      noncomputable def CSMC.PreviousState.Model.extDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ) (y : Pos X n N) (a : Anc n N) (b : Idx n N) :

      The density (S4) of the particle positions y, the ancestor indices a, and the indices b of the reference, where K_{t,j,j} = C(B_t(·|j)).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        noncomputable def CSMC.PreviousState.Model.extMeasure {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ) :

        The distribution with density (S4) with respect to the product of μ on each particle position and of the counting measures on the indices.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          noncomputable def CSMC.PreviousState.Model.algLaw {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (K : Pos X n N × Anc n N → BackwardKernels (Fin N) n) :
          ProbabilityTheory.Kernel (Traj X n) ((Pos X n N × Anc n N × Idx n N) × Idx n N)

          The joint distribution, given the reference trajectory, of the particle positions, the ancestor indices, and the indices of the reference, (y, a, b), and of the indices l of the output, generated by Algorithm S1 with the resampling scheme resdist and the kernels K.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            noncomputable def CSMC.PreviousState.Model.csmc {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (K : Pos X n N × Anc n N → BackwardKernels (Fin N) n) :

            The Markov kernel defined by Algorithm S1 with the resampling scheme resdist and the kernels K.

            Equations
            Instances For

              The numerator of the target density is a measurable function of the trajectory.

              theorem CSMC.PreviousState.Model.measurable_fwdDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) {resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hrm : ∀ (s : Fin n) (a : Fin N → Fin N), Measurable fun (xw : (Fin N → X) × (Fin N → ℝ)) => resdist s xw.1 xw.2 a) {C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ} (hCm : ∀ (i j : Fin N), Measurable fun (p : Fin N → ℝ) => C p i j) (b : Idx n N) (a : Anc n N) :
              Measurable fun (y : Pos X n N) => ↑(M.fwdDensity resdist C b y a)

              For resampling schemes which are measurable functions of the particles and the weights, and kernels C(p) whose entries are measurable functions of p, the density of steps (a) and (b) of Algorithm S1 is, for fixed ancestor indices and indices of the reference, a measurable function of the particle positions.

              theorem CSMC.PreviousState.Model.measurable_extDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) {resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hrm : ∀ (s : Fin n) (a : Fin N → Fin N), Measurable fun (xw : (Fin N → X) × (Fin N → ℝ)) => resdist s xw.1 xw.2 a) {C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ} (hCm : ∀ (i j : Fin N), Measurable fun (p : Fin N → ℝ) => C p i j) :
              Measurable fun (w : Pos X n N × Anc n N × Idx n N) => M.extDensity resdist C w.1 w.2.1 w.2.2

              For resampling schemes which are measurable functions of the particles and the weights, and kernels C(p) whose entries are measurable functions of p, the density (S4) is a measurable function of the particle positions, the ancestor indices, and the indices of the reference.

              instance CSMC.PreviousState.Model.instIsSFiniteKernelTrajProdPosAncIdxForwardPass {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ) :

              The forward pass of Algorithm S1 is an s-finite kernel.

              instance CSMC.PreviousState.Model.instIsSFiniteKernelTrajProdPosAncIdxAlgLaw {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (K : Pos X n N × Anc n N → BackwardKernels (Fin N) n) :

              The joint distribution of the variables of Algorithm S1 is an s-finite kernel.

              instance CSMC.PreviousState.Model.instIsSFiniteKernelTrajCsmc {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ) (K : Pos X n N × Anc n N → BackwardKernels (Fin N) n) :

              The kernel of Algorithm S1 is an s-finite kernel.

              theorem CSMC.PreviousState.Model.weight_congr_anc {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) (y : Pos X n N) {a a' : Anc n N} (t : Fin (n + 1)) (h : ∀ (s : Fin n), s.succ = t → a s = a' s) :
              M.weight y a t = M.weight y a' t

              The weights at time t depend on the ancestor indices only through those at time t - 1.

              theorem CSMC.PreviousState.Model.weight_congr_pos {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) {y y' : Pos X n N} (a : Anc n N) (t : Fin (n + 1)) (h : ∀ (p : Fin (n + 1) × Fin N), p.1 ≤ t → y p = y' p) :
              M.weight y a t = M.weight y' a t

              The weights at time t depend on the particle positions only through those at the times up to t.

              theorem CSMC.PreviousState.Model.isMarkovKernel_forwardPass {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) [MeasureTheory.SigmaFinite μ] (hN : 0 < N) {resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hr : ∀ (s : Fin n), IsUnbiasedResampling (resdist s)) (hrm : ∀ (s : Fin n) (a : Fin N → Fin N), Measurable fun (xw : (Fin N → X) × (Fin N → ℝ)) => resdist s xw.1 xw.2 a) {C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ} (hC : ∀ (p : Fin N → ℝ), IsProbVector p → C p ∈ Matrix.rowStochastic ℝ (Fin N)) (hCm : ∀ (i j : Fin N), Measurable fun (p : Fin N → ℝ) => C p i j) :

              Under the condition of Definition S1 on the resampling schemes, with at least one particle and for Markov kernels C(p), the forward pass is a Markov kernel.

              theorem CSMC.PreviousState.Model.unnormalizedTarget_mul_fwdDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) {resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hr : ∀ (s : Fin n), IsUnbiasedResampling (resdist s)) {C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ} (hC : ∀ (p : Fin N → ℝ), IsProbVector p → IsReversible p (C p)) (y : Pos X n N) (a : Anc n N) (b : Idx n N) :
              unnormalizedTarget M.transdens₁ M.transdens M.pot₁ M.pot (trajOf y b) * M.fwdDensity resdist C b y a = (((((↑N)⁻¹ ^ (n + 1) * (M.weight y a (Fin.last n) (b (Fin.last n))).toNNReal * ∑ i : Fin N, M.pot₁ (y (0, i))) * ∏ i : Fin N, M.transdens₁ (y (0, i))) * ∏ s : Fin n, (resdist s (fun (i : Fin N) => y (s.castSucc, i)) (M.weight y a s.castSucc) (a s)).toNNReal) * ∏ s : Fin n, (∑ i : Fin N, M.pot s (y (s.castSucc, a s i)) (y (s.succ, i))) * ∏ i : Fin N, M.transdens s (y (s.castSucc, a s i)) (y (s.succ, i))) * ∏ s : Fin n, (C (fun (i : Fin N) => M.bsprob y a s i (b s.succ)) (a s (b s.succ)) (b s.castSucc)).toNNReal

              If each C(p) is reversible with respect to p, the numerator of the target density at (x_1^{b_1}, …, x_T^{b_T}) times the density of steps (a) and (b) of Algorithm S1, with c drawn from C(B_t(·|x_{t+1}))(b_t, ·), is the numerator of the density (S4), times N^{-T}. The indices b_t and c_t = a_t^{b_{t+1}} are exchanged by means of the probability r_t(a_t) / (N W_t^{c_t}) of (b_{t+1}, a_t) and of the reversibility of C(B_t(·|b_{t+1})) with respect to B_t(·|b_{t+1}).

              theorem CSMC.PreviousState.Model.target_mul_fwdDensity_eq_extDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) {resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hr : ∀ (s : Fin n), IsUnbiasedResampling (resdist s)) {C : (Fin N → ℝ) → Matrix (Fin N) (Fin N) ℝ} (hC : ∀ (p : Fin N → ℝ), IsProbVector p → IsReversible p (C p)) (y : Pos X n N) (a : Anc n N) (b : Idx n N) :
              M.normconst⁻¹ * ↑(unnormalizedTarget M.transdens₁ M.transdens M.pot₁ M.pot (trajOf y b)) * ↑(M.fwdDensity resdist C b y a) = M.extDensity resdist C y a b

              If each C(p) is reversible with respect to p, the density of x_{1:T} ∼ π followed by steps (a) and (b) of Algorithm S1, with c drawn from C(B_t(·|x_{t+1}))(b_t, ·), is the density (S4) at (y, a, b).

              theorem CSMC.PreviousState.Model.target_mul_fwdDensity_diagKernel_eq_extDensity {X : Type u_1} [MeasurableSpace X] {n N : ℕ} {μ : MeasureTheory.Measure X} (M : Model μ n) {resdist : Fin n → (Fin N → X) → (Fin N → ℝ) → (Fin N → Fin N) → ℝ} (hr : ∀ (s : Fin n), IsUnbiasedResampling (resdist s)) (r : SelectionRule) (y : Pos X n N) (a : Anc n N) (b : Idx n N) :
              M.normconst⁻¹ * ↑(unnormalizedTarget M.transdens₁ M.transdens M.pot₁ M.pot (trajOf y b)) * ↑(M.fwdDensity resdist r.diagKernel b y a) = M.extDensity resdist r.diagKernel y a b

              The pointwise identity of the proof of Lemma S1: with the kernels K_{t,j,j} of one of the six selection rules, the density of x_{1:T} ∼ π followed by steps (a) and (b) of Algorithm S1 is the density (S4). The kernels K_{t,j,j} are reversible with respect to B_t(·|j), because the identity kernel, the Gibbs kernel, and, by Lemma 1, the forced move F_p are reversible with respect to p.

              The kernels of each selection rule, with the probabilities (S3), are measurable functions of the particle positions and the ancestor indices.