1. 25 Sep, 2020 1 commit
    • Chris Jewell's avatar
      Refactored model specification · e52283b6
      Chris Jewell authored
      1. Created a TFP JointDistribution to represent full probability model;
      2. Renamed CovidUKStochastic --> DiscreteTimeStateTransitionModel;
      3. DiscreteTimeStateTransitionModel now inherits from tfp.Distribution.
  2. 04 Sep, 2020 1 commit
    • Chris Jewell's avatar
      Pulled dates out of CovidUKStochastic class · 588d479e
      Chris Jewell authored
      1. Dates are pulled out of CovidUKStochastic
      2. CovidUKStochastic now behaves more like a tfd.Distribution
          * CovidUKStochastic is now instantiated with an initial time, number of time steps and
      time step size
          * CovidUKStochastic is now instantiated with the initial state.
  3. 23 Aug, 2020 1 commit
    • Chris Jewell's avatar
      Corrected data misalignment · 2d0e3f80
      Chris Jewell authored
      1. We adopt the convention [start, end) for *all* date ranges.
      2. Modified PHE case ingestor to reflect this
      3. Modified CovidUK to reflect this
      4. Corrected a bug in the use of time in simulation.
  4. 08 Jul, 2020 1 commit
  5. 28 Jun, 2020 5 commits
    • Chris Jewell's avatar
      Cast to float32 for tfd.Multinomial.log_prob · c107d280
      Chris Jewell authored
      Cast data structures to float32 for tfd.Multinomial.log_prob
      computation saves time on lgamma calculation.  Approx x1.8 speedup as
      lgamma is approx linear in digits of precision required.
    • Chris Jewell's avatar
      Replace tf.map_fn with tf.vectorized_map · 500fb5b0
      Chris Jewell authored
      Results in over a x2 speedup.
    • Chris Jewell's avatar
      Batched transition matrix computation · c1ae5320
      Chris Jewell authored
      Moved construction of Markov transition matrix format from
      model.make_hazard.h into discrete_markov_log_prob.  Achieved a 33%
      increase in run speed.
    • Chris Jewell's avatar
      Performance improvement · d4a78476
      Chris Jewell authored
      Re-wrote discrete_markov_log_prob to batch the call to
      tfd.Multinomial.log_prob to avoid lgamma time.
    • Chris Jewell's avatar
      Changes: · 77eeffd1
      Chris Jewell authored
      1. Replaced TensorArray buffer with simple reduction in
      2. tf.lgamma is slow with lots of events, so cast to tf.float32 gives
      a  a bit over x2 speedup.
  6. 26 Jun, 2020 1 commit
    • Chris Jewell's avatar
      Changed storage order of events matrix. · 0291aa34
      Chris Jewell authored
      Previously, the Events matrix expected by model.log_prob was ordered
      [T, M, X] where T is the number of timpoints, M is the number of
      meta-populations and X is the number of transitions.  However, it was
      found more convenient to work with [M, T, X] for the purposes of data
      augmentation.  This meant extra tf.transpose calls.
      model.log_prob now expects [M, T, X], with any further batch
      dimensions added as outer dimensions.
  7. 12 May, 2020 1 commit
  8. 28 Apr, 2020 1 commit
  9. 23 Apr, 2020 1 commit
  10. 20 Apr, 2020 1 commit
  11. 17 Apr, 2020 1 commit
  12. 10 Apr, 2020 1 commit
  13. 09 Apr, 2020 2 commits
  14. 08 Apr, 2020 1 commit
    • Chris Jewell's avatar
      Major changes: · 94fe710d
      Chris Jewell authored
      1. chainbinom* file and methods renamed to discrete_markov* files and methods.
      2. Implemented batched hazard rate calculation, adding functions to automatically broadcast rates to the Markov transition rate matrix.
      3. Implemented test simulation and MCMC algorithm.
  15. 30 Mar, 2020 1 commit
  16. 28 Mar, 2020 2 commits
  17. 27 Mar, 2020 2 commits
    • Christopher Suter's avatar
    • Christopher Suter's avatar
      Improve efficiency of stochastic model. · 864fcf65
      Christopher Suter authored
      Big changes:
       1. replace python for loop with tf.while_loop
       2. work with a transposed state tensor shape
         - instead of [4, nlads * nages], use [nlads * nages, 4]
         - this made it pretty easy to eliminate some transposes in
           propagate_fn (there were comments there seemingly contemplating
           this shape arrangement)
         - this feels a little more natural to me, too; in TFP we'd call the 4
           SEIR states components of the "event shape" of the system, and the
           nlads * nages part a "batch shape" (although one could reasonably
           also combine these together into one big matrix "event shape")
         - anyway, this allowed elimination of 3 transpose ops which makes for
           simpler code and avoids some memcpys
         - I also made an effort to update surrounding code to use the same data
           layout, but it seems like mcmc.py and covid_ode.py are broken right
           now anyway, due to other changes made in support of stochastic mode,
           so I couldn't confirm that my changes were sufficient.
       3. switch off XLA (which didn't yield any clear improvement, although
          it also didn't really hurt), and disable autograph (which tries to
          do things like rewrite python for loops into TF graph code but tends
          to produce less performant than manually optimized code like what
          I've done here)
  18. 26 Mar, 2020 3 commits
  19. 12 Mar, 2020 1 commit
  20. 08 Mar, 2020 2 commits
  21. 01 Mar, 2020 2 commits