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

Contributions towards Arma/Arima models #531

Merged
merged 16 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Issue 529: Create null Latent model (#530)
* Null Latent model

* Null Latent model

* fix doctest
  • Loading branch information
SamuelBrand1 authored Nov 20, 2024
commit ae73647df65fb9970e8a8a08e0783a30f7f57863
3 changes: 2 additions & 1 deletion EpiAware/src/EpiLatentModels/EpiLatentModels.jl
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ using Turing, Distributions, DocStringExtensions, LinearAlgebra, SparseArrays,
OrdinaryDiffEq

#Export models
export FixedIntercept, Intercept, RandomWalk, AR, HierarchicalNormal
export FixedIntercept, Intercept, RandomWalk, AR, HierarchicalNormal, Null

#Export ODE definitions
export SIRParams, SEIRParams
@@ -38,6 +38,7 @@ include("models/Intercept.jl")
include("models/RandomWalk.jl")
include("models/AR.jl")
include("models/HierarchicalNormal.jl")
include("models/Null.jl")
include("odemodels/SIRParams.jl")
include("odemodels/SEIRParams.jl")
include("modifiers/DiffLatentModel.jl")
24 changes: 24 additions & 0 deletions EpiAware/src/EpiLatentModels/models/Null.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@doc raw"
A null model struct. This struct is used to indicate that no latent variables are to be generated.
"
struct Null <: AbstractTuringLatentModel end

@doc raw"
Generates `nothing` as latent variables for the given `latent_model` of type `Null`.

# Example
```jldoctest
using EpiAware
null = Null()
null_mdl = generate_latent(null, 10)
isnothing(null_mdl())

# output

true

```
"
@model function EpiAwareBase.generate_latent(latent_model::Null, n)
return nothing
end
8 changes: 8 additions & 0 deletions EpiAware/test/EpiLatentModels/models/Null.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@testitem "Null Model Tests" begin
# Test that Null can be instantiated
@test Null() isa Null

# Test that generate_latent returns nothing
null = Null()
@test isnothing(generate_latent(null, 10)())
end
Loading