Skip to content

Commit 1e4ce9f

Browse files
committed
p.default -> p.fallback
1 parent 9626ae9 commit 1e4ce9f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/contexts/init.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,34 @@ end
7373
"""
7474
ParamsInit(
7575
params::Union{AbstractDict{<:VarName},NamedTuple},
76-
default::Union{AbstractInitStrategy,Nothing}=PriorInit()
76+
fallback::Union{AbstractInitStrategy,Nothing}=PriorInit()
7777
)
7878
7979
Obtain new values by extracting them from the given dictionary or NamedTuple.
8080
81-
The parameter `default` specifies how new values are to be obtained if they
82-
cannot be found in `params`, or they are specified as `missing`. `default`
81+
The parameter `fallback` specifies how new values are to be obtained if they
82+
cannot be found in `params`, or they are specified as `missing`. `fallback`
8383
can either be an initialisation strategy itself, in which case it will be
8484
used to obtain new values, or it can be `nothing`, in which case an error
85-
will be thrown. The default for `default` is `PriorInit()`.
85+
will be thrown. The default for `fallback` is `PriorInit()`.
8686
8787
!!! note
8888
The values in `params` must be provided in the space of the untransformed
8989
distribution.
9090
"""
9191
struct ParamsInit{P,S<:Union{AbstractInitStrategy,Nothing}} <: AbstractInitStrategy
9292
params::P
93-
default::S
93+
fallback::S
9494
function ParamsInit(
95-
params::AbstractDict{<:VarName}, default::Union{AbstractInitStrategy,Nothing}
95+
params::AbstractDict{<:VarName}, fallback::Union{AbstractInitStrategy,Nothing}
9696
)
97-
return new{typeof(params),typeof(default)}(params, default)
97+
return new{typeof(params),typeof(fallback)}(params, fallback)
9898
end
9999
ParamsInit(params::AbstractDict{<:VarName}) = ParamsInit(params, PriorInit())
100100
function ParamsInit(
101-
params::NamedTuple, default::Union{AbstractInitStrategy,Nothing}=PriorInit()
101+
params::NamedTuple, fallback::Union{AbstractInitStrategy,Nothing}=PriorInit()
102102
)
103-
return ParamsInit(to_varname_dict(params), default)
103+
return ParamsInit(to_varname_dict(params), fallback)
104104
end
105105
end
106106
function init(rng::Random.AbstractRNG, vn::VarName, dist::Distribution, p::ParamsInit)
@@ -111,17 +111,17 @@ function init(rng::Random.AbstractRNG, vn::VarName, dist::Distribution, p::Param
111111
return if hasvalue(p.params, vn, dist)
112112
x = getvalue(p.params, vn, dist)
113113
if x === missing
114-
p.default === nothing &&
114+
p.fallback === nothing &&
115115
error("A `missing` value was provided for the variable `$(vn)`.")
116-
init(rng, vn, dist, p.default)
116+
init(rng, vn, dist, p.fallback)
117117
else
118118
# TODO(penelopeysm): Since x is user-supplied, maybe we could also
119119
# check here that the type / size of x matches the dist?
120120
x
121121
end
122122
else
123-
p.default === nothing && error("No value was provided for the variable `$(vn)`.")
124-
init(rng, vn, dist, p.default)
123+
p.fallback === nothing && error("No value was provided for the variable `$(vn)`.")
124+
init(rng, vn, dist, p.fallback)
125125
end
126126
end
127127

0 commit comments

Comments
 (0)