-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 529: Create null Latent model (#530)
* Null Latent model * Null Latent model * fix doctest
- Loading branch information
1 parent
7fd98c8
commit ae73647
Showing
3 changed files
with
34 additions
and
1 deletion.
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
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 |
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,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 |