-
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.
Implement daily ascertainment in underlying truth data sampling (#279)
* Update TruthSimulationConfig.jl * Extra deps for more functionality * Change Truth simulation approach to specifying all parameters * update unit tests * constructor for parameters that don't change from experiment to experiment * update generate_truthdata * remove unnecessary line
- Loading branch information
1 parent
d3f1f9c
commit 453fa1e
Showing
10 changed files
with
129 additions
and
38 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,25 @@ | ||
""" | ||
Constructs a dictionary of default parameters for the given `pipeline`. This is the default method. | ||
These are parameters that aren't expected to change by experiment. | ||
# Arguments | ||
- `pipeline`: An instance of `AbstractEpiAwarePipeline`. | ||
# Returns | ||
A dictionary containing the default parameters: | ||
- `"Rt"`: The value returned by `make_Rt(pipeline)`. | ||
- `"logit_daily_ascertainment"`: An array of values, with the first 5 elements set to 0 and the last 2 elements set to -0.5. | ||
- `"cluster_factor"`: The value 0.1. | ||
- `"I0"`: The value 100.0. | ||
""" | ||
function make_default_params(pipeline::AbstractEpiAwarePipeline) | ||
Rt = make_Rt(pipeline) | ||
logit_daily_ascertainment = [zeros(5); -0.5 * ones(2)] | ||
cluster_factor = 0.05 | ||
I0 = 100.0 | ||
return Dict( | ||
"Rt" => Rt, | ||
"logit_daily_ascertainment" => logit_daily_ascertainment, | ||
"cluster_factor" => cluster_factor, | ||
"I0" => I0) | ||
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,18 @@ | ||
using Test | ||
|
||
@testset "make_default_params" begin | ||
# Mock pipeline object | ||
struct MockPipeline <: AbstractEpiAwarePipeline end | ||
pipeline = MockPipeline() | ||
|
||
# Expected default parameters | ||
expected_params = Dict( | ||
"Rt" => 1.0, | ||
"logit_daily_ascertainment" => [zeros(5); -0.5 * ones(2)], | ||
"cluster_factor" => 0.1, | ||
"I0" => 100.0 | ||
) | ||
|
||
# Test the make_default_params function | ||
@test make_default_params(pipeline) == expected_params | ||
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
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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
|
||
# Test the TruthSimulationConfig struct constructor | ||
@testset "TruthSimulationConfig" begin | ||
using Distributions, EpiAwarePipeline, EpiAware | ||
gi = Gamma(2, 2) | ||
using Distributions, EpiAwarePipeline, EpiAware, LogExpFunctions | ||
logit_daily_ascertainment = [fill(1.0, 5); fill(0.5, 2)] | ||
normed_daily_ascertainment = logit_daily_ascertainment |> x -> 7 * softmax(x) | ||
config = TruthSimulationConfig( | ||
truth_process = [0.5, 0.8, 1.2], gi_mean = 3.0, gi_std = 2.0) | ||
truth_process = [0.5, 0.8, 1.2], gi_mean = 3.0, gi_std = 2.0, logit_daily_ascertainment = logit_daily_ascertainment, | ||
cluster_factor = 0.1, I0 = 100.0) | ||
|
||
@testset "truth_Rt" begin | ||
@test config.truth_process == [0.5, 0.8, 1.2] | ||
@test config.gi_mean == 3.0 | ||
@test config.gi_std == 2.0 | ||
@test 7 * softmax(config.logit_daily_ascertainment) == normed_daily_ascertainment | ||
@test config.cluster_factor == 0.1 | ||
@test config.I0 == 100.0 | ||
@test config.igp == Renewal | ||
end | ||
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