Skip to content

Commit

Permalink
Make MyRt in hospital_admissions_model.qmd more flexible (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
damonbayer authored Jul 23, 2024
1 parent 9243173 commit 9607ea8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/source/tutorials/hospital_admissions_model.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ gen_int = deterministic.DeterministicPMF(gen_int, name="gen_int")
class MyRt(metaclass.RandomVariable):
def __init__(self, sd_rv):
self.sd_rv = sd_rv
def validate(self):
pass
def sample(self, n_steps: int, **kwargs) -> tuple:
sd_rt = numpyro.sample("Rt_random_walk_sd", dist.HalfNormal(0.025))
sd_rt, *_ = self.sd_rv()
rt_rv = metaclass.TransformedRandomVariable(
"Rt_rv",
Expand All @@ -207,7 +209,9 @@ class MyRt(metaclass.RandomVariable):
return rt_rv.sample(n_steps=n_steps, **kwargs)
rtproc = MyRt()
rtproc = MyRt(
metaclass.DistributionalRV(dist.HalfNormal(0.025), "Rt_random_walk_sd")
)
# The observation model
Expand Down

0 comments on commit 9607ea8

Please sign in to comment.