File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,42 @@ See also: [`DynamicPPL.is_suitable_varinfo`](@ref).
44
44
45
45
# Keyword Arguments
46
46
- `only_ddpl`: If `true`, only consider error reports within DynamicPPL.jl.
47
+
48
+ # Examples
49
+
50
+ ```jldoctest
51
+ julia> using DynamicPPL.Experimental: determine_suitable_varinfo
52
+
53
+ julia> using JET: JET # needs to be loaded for full functionality
54
+
55
+ julia> @model function model_with_random_support()
56
+ x ~ Bernoulli()
57
+ if x
58
+ y ~ Normal()
59
+ else
60
+ z ~ Normal()
61
+ end
62
+ end
63
+ model_with_random_support (generic function with 2 methods)
64
+
65
+ julia> model = model_with_random_support();
66
+
67
+ julia> # Typed varinfo cannot handle this random support model properly
68
+ # as using a single execution of the model will not see all random variables.
69
+ # Hence, this this model requires untyped varinfo.
70
+ varinfo = determine_suitable_varinfo(model);
71
+
72
+ julia> varinfo isa typeof(DynamicPPL.untyped_varinfo(model))
73
+ true
74
+
75
+ julia> # In contrast, a simple model with no random support can be handled by typed varinfo.
76
+ @model model_with_static_support() = x ~ Normal()
77
+
78
+ julia> varinfo = determine_suitable_varinfo(model_with_static_support());
79
+
80
+ julia> varinfo isa typeof(DynamicPPL.typed_varinfo(model_with_static_support()))
81
+ true
82
+ ```
47
83
"""
48
84
function determine_suitable_varinfo (
49
85
model:: DynamicPPL.Model ,
You can’t perform that action at this time.
0 commit comments