pfjax.models.pgnet_model

Module Contents

Classes

PGNETModel

Prokaryotic auto-regulatory gene network Model.

class pfjax.models.pgnet_model.PGNETModel(dt, n_res, bootstrap=True)[source]

Bases: pfjax.sde.SDEModel

Prokaryotic auto-regulatory gene network Model.

The base model involves differential equations of the chemical reactions:

DNA + P2 --> DNA_P2
DNA_P2   --> DNA + P2
DNA      --> DNA + RNA
RNA      --> RNA + P
P + P    --> P2
P2       --> P + P
RNA      --> 0
P        --> 0

These equations are associated with a parameter in theta = (theta0, …, theta7). The model is approximated by a SDE described in Golightly & Wilkinson (2005). A particular restriction on the chemical reactions is by the conservation law which implies that DNA + DNA_P2 = K. Thus the SDE model can be described in terms of x_t = (RNA, P, P2, DNA).

Then assuming a standard form of the SDE, the base model can be written as

x_mt = x_{m, t-1} + mu_mt dt/m + Sigma_mt^{1/2} dt/m
y_t ~ N( exp(x_{m,mt}), diag(tau^2) )

Ito’s Lemma is applied to transform the base model on the log-scale to allow for unconstrained variables

logx_mt = log(x_mt)

so mu_mt and Sigma_mt are transformed accordingly.

  • Model parameters: theta = (theta0, … theta7, tau0, … tau3).

  • Global constants: dt and n_res, i.e., m.

  • State dimensions: n_state = (n_res, 4).

  • Measurement dimensions: n_meas = 4.

Parameters
  • dt – SDE interobservation time.

  • n_res – SDE resolution number. There are n_res latent variables per observation, equally spaced with interobservation time dt/n_res.

  • bootstrap (bool) – Flag indicating whether to use a Bootstrap particle filter or a bridge filter.

drift(x, theta)[source]

Calculates the SDE drift function on the log scale.

diff(x, theta)[source]

Calculates the SDE diffusion function on the log scale.

meas_lpdf(y_curr, x_curr, theta)[source]

Log-density of p(y_curr | x_curr, theta).

Parameters
  • y_curr – Measurement variable at current time t.

  • x_curr – State variable at current time t.

  • theta – Parameter value.

Returns

The log-density of p(y_curr | x_curr, theta).

meas_sample(key, x_curr, theta)[source]

Sample from p(y_curr | x_curr, theta).

Parameters
  • x_curr – State variable at current time t.

  • theta – Parameter value.

  • key – PRNG key.

Returns

y_curr ~ p(y_curr | x_curr, theta).

Return type

Sample of the measurement variable at current time t

pf_init(key, y_init, theta)[source]

Particle filter calculation for x_init.

Samples from an importance sampling proposal distribution

x_init ~ q(x_init) = q(x_init | y_init, theta)

and calculates the log weight

logw = log p(y_init | x_init, theta) + log p(x_init | theta) - log q(x_init)

FIXME: Explain what the proposal is and why it gives logw = CONST.

Parameters
  • y_init – Measurement variable at initial time t = 0.

  • theta – Parameter value.

  • key – PRNG key.

Returns

  • x_init: A sample from the proposal distribution for x_init.

  • logw: The log-weight of x_init.

Return type

Tuple

pf_step(key, x_prev, y_curr, theta)[source]

Get particles at subsequent steps.

Parameters
  • x_prev – State variable at previous time t-1.

  • y_curr – Measurement variable at current time t.

  • theta – Parameter value.

  • key – PRNG key.

Returns

  • x_curr: Sample of the state variable at current time t: x_curr ~ q(x_curr).

  • logw: The log-weight of x_curr.

Return type

Tuple