Kappa-Dev / KappaTools

Tool suite for kappa models. Documentation and binaries can be found in the release section. Try it online at
http://kappalanguage.org/
GNU Lesser General Public License v3.0
113 stars 41 forks source link

Adding stochastic operations to perturbation language #317

Open yarden opened 7 years ago

yarden commented 7 years ago

(This is a feature request not a bug.)

Following discussions with @pirbo and @plucky, it would be great to have a more flexible perturbation language in Kappa that allows for stochastic perturbations, such as:

  1. Specifying a perturbation of random magnitude at a deterministic time t (where magnitude is drawn from a distribution, e.g., Gaussian).
  2. Specifying a perturbation at a random time t (where t itself is drawn from a distribution).

Exposing a random number generator in perturbation language (e.g., ability to sample from Uniform(0, 1) distribution) would be a step in this direction, but it'd be better if sampling functions for frequently used distributions (such as Gaussian, Beta/Dirichlet, Gamma, Exponential, etc.) from O'Caml could be called in perturbation language.

Perturbations written down this way are "external" to the system being modeled. As an alternative, we also discussed the possibility of having perturbations that are random because they're a function of a quantity in the Kappa model that fluctuates randomly as result of stochastic simulation. However, in the biological applications I'm most interested in, having the randomness of the perturbations be specified separately from the Kappa model is more intuitive.

A simple hack to generate random perturbations now is to have an external program that generates the random times and magnitudes and feeds those as deterministic perturbations to Kappa, and repeats this for many rounds. That might generate a long list of perturbation in each round (which might not be a problem).

Yarden

jkrivine commented 7 years ago

Yes I like this feature. The main problem is the "stopping time" issue which imposes that the precondition for a perturbation depending on time should be of the form T=n. But I guess it's OK if n is a random variable that one can draw during the initialization phase. Another usage of random_law(0,n) is to randomize kinetic rates.

feret commented 7 years ago

When a perturbation is repeated, I fear that some people would prefer the random number to be redrawn at each iteration of the perturbation.
There could be a convention to fix which random numbers shall be drawn once for all, and which one shall be volatile; There could also be two different instructions random_constant VS random_volatile.

Le 30 déc. 2016 à 10:18, Krivine notifications@github.com a écrit :

Yes I like this feature. The main problem is the "stopping time" issue which imposes that the precondition for a perturbation depending on time should be of the form T=n. But I guess it's OK if n is a random variable that one can draw during the initialization phase. Another usage of random_law(0,n) is to randomize kinetic rates.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kappa-Dev/KaSim/issues/317#issuecomment-269749501, or mute the thread https://github.com/notifications/unsubscribe-auth/AARts6PLhxP3XQFwwy9-SmAF7tq-J4uiks5rNMxIgaJpZM4LGxjr.