-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial type definition for EpiAwareProblem * minor changes * export new types * simple constructor test
- Loading branch information
1 parent
5c373d0
commit 4b6ca67
Showing
7 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Defines an inference/generative modelling problem for case data. | ||
`EpiAwareProblem` wraps the underlying components of an epidemiological model: | ||
- `epi_model`: An epidemiological model for unobserved infections. | ||
- `latent_model`: A latent model for underlying latent process. | ||
- `observation_model`: An observation model for observed cases. | ||
Along with a `tspan` tuple for the time span of the case data. | ||
""" | ||
@kwdef struct EpiAwareProblem{ | ||
E <: AbstractEpiModel, L <: AbstractLatentModel, O <: AbstractObservationModel} <: | ||
AbstractEpiAwareProblem | ||
"Epidemiological model for unobserved infections." | ||
epi_model::E | ||
"Latent model for underlying latent process." | ||
latent_model::L | ||
"Observation model for observed cases." | ||
observation_model::O | ||
"Time span for either inference or generative modelling of case time series." | ||
tspan::Tuple{Int, Int} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,6 @@ | |
return (; | ||
generated_y_t, | ||
I_t, | ||
latent_model, | ||
Z_t, | ||
process_aux = merge(latent_model_aux, generated_y_t_aux)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@testitem "EpiAwareProblem Tests" begin | ||
using Distributions | ||
# Define test inputs | ||
data = EpiData([0.2, 0.3, 0.5], exp) | ||
epi_model = DirectInfections(data, Normal()) | ||
latent_model = RandomWalk(Normal(0.0, 1.0), truncated(Normal(0.0, 0.05), 0.0, Inf)) | ||
delay_int = [0.2, 0.3, 0.5] | ||
time_horizon = 30 | ||
obs_prior = default_delay_obs_priors() | ||
|
||
obs_model = DelayObservations(delay_int, time_horizon, | ||
obs_prior[:neg_bin_cluster_factor_prior]) | ||
tspan = (0, 365) | ||
|
||
# Create an instance of EpiAwareProblem | ||
problem = EpiAwareProblem(epi_model, latent_model, obs_model, tspan) | ||
|
||
@test typeof(problem) <: EpiAwareProblem | ||
@test typeof(problem.epi_model) <: DirectInfections | ||
@test typeof(problem.latent_model) <: RandomWalk | ||
@test typeof(problem.observation_model) <: DelayObservations | ||
@test problem.tspan == (0, 365) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters