@@ -243,7 +243,7 @@ julia> model() ≠ 1.0
243243true
244244
245245julia> # To condition the variable inside `demo_inner` we need to refer to it as `inner.m`.
246- conditioned_model = model | (var" inner.m" = 1.0, );
246+ conditioned_model = model | (@varname( inner.m) => 1.0, );
247247
248248julia> conditioned_model()
2492491.0
@@ -255,15 +255,6 @@ julia> conditioned_model_fail()
255255ERROR: ArgumentError: `~` with a model on the right-hand side of an observe statement is not supported
256256[...]
257257```
258-
259- And similarly when using `Dict`:
260-
261- ```jldoctest condition
262- julia> conditioned_model_dict = model | (@varname(var"inner.m") => 1.0);
263-
264- julia> conditioned_model_dict()
265- 1.0
266- ```
267258"""
268259function AbstractPPL. condition (model:: Model , values... )
269260 # Positional arguments - need to handle cases carefully
@@ -583,7 +574,7 @@ julia> model = demo_outer();
583574julia> model() ≠ 1.0
584575true
585576
586- julia> fixed_model = fix(model, var" inner.m" = 1.0, );
577+ julia> fixed_model = fix(model, (@varname( inner.m) => 1.0, ) );
587578
588579julia> fixed_model()
5895801.0
@@ -599,24 +590,9 @@ julia> fixed_model()
5995902.0
600591```
601592
602- And similarly when using `Dict`:
603-
604- ```jldoctest fix
605- julia> fixed_model_dict = fix(model, @varname(var"inner.m") => 1.0);
606-
607- julia> fixed_model_dict()
608- 1.0
609-
610- julia> fixed_model_dict = fix(model, @varname(inner) => 2.0);
611-
612- julia> fixed_model_dict()
613- 2.0
614- ```
615-
616593## Difference from `condition`
617594
618- A very similar functionality is also provided by [`condition`](@ref) which,
619- not surprisingly, _conditions_ variables instead of fixing them. The only
595+ A very similar functionality is also provided by [`condition`](@ref). The only
620596difference between fixing and conditioning is as follows:
621597- `condition`ed variables are considered to be observations, and are thus
622598 included in the computation [`logjoint`](@ref) and [`loglikelihood`](@ref),
@@ -798,11 +774,11 @@ julia> fixed(cm)
798774julia> # Since we fixed on `m`, not `a.m` as it will appear after prefixed,
799775 # `a.m` is treated as a random variable.
800776 keys(VarInfo(cm))
801- 1-element Vector{VarName{Symbol("a.m"), typeof(identity) }}:
777+ 1-element Vector{VarName{:a, Accessors.PropertyLens{:m} }}:
802778 a.m
803779
804780julia> # If we instead fix on `a.m`, `m` in the model will be considered an observation.
805- cm = fix(contextualize(m, PrefixContext{:a}(fix(var" a.m"= 1.0))), x=100.0);
781+ cm = fix(contextualize(m, PrefixContext{:a}(fix(@varname( a.m) => 1.0, ))), x=100.0);
806782
807783julia> fixed(cm).x
808784100.0
0 commit comments