Skip to content

Commit

Permalink
Support HaarReparam for non-compartmental variables (#2523)
Browse files Browse the repository at this point in the history
* Attempt to apply HaarReparam to non-compartmental time series

* Factor _sample_auxiliary() out of three models

* Fix tests

* Remove debug statement

* Fix docstring

* Bump pytest version

* Update pytest marks

* Fix typo
  • Loading branch information
fritzo authored Jun 13, 2020
1 parent d18fec8 commit f7a5677
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 123 deletions.
8 changes: 6 additions & 2 deletions docs/source/contrib.epidemiology.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Epidemiological Models
======================
Epidemiology
============
.. automodule:: pyro.contrib.epidemiology

.. warning:: Code in ``pyro.contrib.epidemiology`` is under development.
Expand All @@ -19,6 +19,7 @@ Base Compartmental Model
------------------------
.. automodule:: pyro.contrib.epidemiology.compartmental
:members:
:show-inheritance:
:member-order: bysource

Example Models
Expand All @@ -29,8 +30,11 @@ Distributions
-------------
.. automodule:: pyro.contrib.epidemiology.distributions
:members:
:show-inheritance:
:member-order: bysource

.. autoclass:: pyro.distributions.CoalescentRateLikelihood
:members:
:show-inheritance:
:member-order: bysource
:special-members: __call__
2 changes: 1 addition & 1 deletion examples/contrib/epidemiology/regional.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch

import pyro
from pyro.contrib.epidemiology import RegionalSIRModel
from pyro.contrib.epidemiology.models import RegionalSIRModel

logging.basicConfig(format='%(message)s', level=logging.INFO)

Expand Down
5 changes: 3 additions & 2 deletions examples/contrib/epidemiology/sir.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
from torch.distributions import biject_to, constraints

import pyro
from pyro.contrib.epidemiology import (HeterogeneousSIRModel, OverdispersedSEIRModel, OverdispersedSIRModel,
SimpleSEIRModel, SimpleSIRModel, SuperspreadingSEIRModel, SuperspreadingSIRModel)
from pyro.contrib.epidemiology.models import (HeterogeneousSIRModel, OverdispersedSEIRModel, OverdispersedSIRModel,
SimpleSEIRModel, SimpleSIRModel, SuperspreadingSEIRModel,
SuperspreadingSIRModel)

logging.basicConfig(format='%(message)s', level=logging.INFO)

Expand Down
13 changes: 0 additions & 13 deletions pyro/contrib/epidemiology/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,9 @@

from .compartmental import CompartmentalModel
from .distributions import beta_binomial_dist, binomial_dist, infection_dist
from .models import (HeterogeneousSIRModel, OverdispersedSEIRModel, OverdispersedSIRModel, RegionalSIRModel,
SimpleSEIRModel, SimpleSIRModel, SparseSIRModel, SuperspreadingSEIRModel, SuperspreadingSIRModel,
UnknownStartSIRModel)

__all__ = [
"CompartmentalModel",
"HeterogeneousSIRModel",
"OverdispersedSEIRModel",
"OverdispersedSIRModel",
"RegionalSIRModel",
"SimpleSEIRModel",
"SimpleSIRModel",
"SparseSIRModel",
"SuperspreadingSEIRModel",
"SuperspreadingSIRModel",
"UnknownStartSIRModel",
"beta_binomial_dist",
"binomial_dist",
"infection_dist",
Expand Down
Loading

0 comments on commit f7a5677

Please sign in to comment.