Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 563: Change lookback to 90 time steps #564

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pipeline/src/constructors/make_default_params.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function make_default_params(pipeline::AbstractEpiAwarePipeline)
α_delay = 4.0
θ_delay = 5.0 / 4.0
lookahead = 21
lookback = 35
lookback = 90
stride = 7
return Dict(
"Rt" => Rt,
Expand Down
4 changes: 2 additions & 2 deletions pipeline/src/constructors/make_tspan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Constructs a time span for performing inference on a case data time series. This
- `T::Union{Integer,Nothing} = nothing`: The `stop` point at which to construct
the time span. If `nothing`, the time span will be constructed using the
length of the Rt vector for `pipeline`.
- `lookback = 35`: The number of days to look back from the specified time point.
- `lookback`: The number of days to look back from the specified time point.

# Returns
A tuple `(start, stop)` representing the start and stop indices of the time span.
Expand All @@ -16,7 +16,7 @@ A tuple `(start, stop)` representing the start and stop indices of the time span

"""
function make_tspan(pipeline::AbstractEpiAwarePipeline;
T::Union{Integer, Nothing} = nothing, lookback = 35)
T::Union{Integer, Nothing} = nothing, lookback)
N = size(make_Rt(pipeline), 1)
_T = isnothing(T) ? N : T
return (max(1, _T - lookback), min(N, _T))
Expand Down
2 changes: 2 additions & 0 deletions pipeline/src/infer/InferenceConfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ to make inference on and model configuration.
function create_inference_results(config, epiprob)
#Return the sampled infections and observations
idxs = config.tspan[1]:config.tspan[2]
#Subselect the case data to the time span
y_t = ismissing(config.case_data) ? missing :
Vector{Union{Missing, Int64}}(config.case_data[idxs])
#Run inference once
inference_results = apply_method(epiprob,
config.epimethod,
(y_t = y_t,)
Expand Down
4 changes: 2 additions & 2 deletions pipeline/test/constructors/test_constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
@testset "default_tspan: returns an Tuple{Integer, Integer}" begin
pipeline = EpiAwareExamplePipeline()

tspan = make_tspan(pipeline)
tspan = make_tspan(pipeline; lookback = 90)
@test tspan isa Tuple{Integer, Integer}
end

Expand Down Expand Up @@ -138,7 +138,7 @@ end
"α_delay" => 4.0,
"θ_delay" => 5.0 / 4.0,
"lookahead" => 21,
"lookback" => 35,
"lookback" => 90,
"stride" => 7
)

Expand Down
Loading