Skip to content

Commit 5c2a625

Browse files
committed
Tiny style improvements
1 parent 1a4eadb commit 5c2a625

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/contexts.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ getsampler(::IsParent, context::AbstractContext) = getsampler(childcontext(conte
188188
"""
189189
struct DefaultContext <: AbstractContext end
190190
191-
The `DefaultContext` is used by default to compute the log joint probability of the data
191+
The `DefaultContext` is used by default to compute the log joint probability of the data
192192
and parameters when running the model.
193193
"""
194194
struct DefaultContext <: AbstractContext end
@@ -199,7 +199,7 @@ NodeTrait(context::DefaultContext) = IsLeaf()
199199
vars::Tvars
200200
end
201201
202-
The `PriorContext` enables the computation of the log prior of the parameters `vars` when
202+
The `PriorContext` enables the computation of the log prior of the parameters `vars` when
203203
running the model.
204204
"""
205205
struct PriorContext{Tvars} <: AbstractContext
@@ -213,8 +213,8 @@ NodeTrait(context::PriorContext) = IsLeaf()
213213
vars::Tvars
214214
end
215215
216-
The `LikelihoodContext` enables the computation of the log likelihood of the parameters when
217-
running the model. `vars` can be used to evaluate the log likelihood for specific values
216+
The `LikelihoodContext` enables the computation of the log likelihood of the parameters when
217+
running the model. `vars` can be used to evaluate the log likelihood for specific values
218218
of the model's parameters. If `vars` is `nothing`, the parameter values inside the `VarInfo` will be used by default.
219219
"""
220220
struct LikelihoodContext{Tvars} <: AbstractContext
@@ -229,10 +229,10 @@ NodeTrait(context::LikelihoodContext) = IsLeaf()
229229
loglike_scalar::T
230230
end
231231
232-
The `MiniBatchContext` enables the computation of
233-
`log(prior) + s * log(likelihood of a batch)` when running the model, where `s` is the
234-
`loglike_scalar` field, typically equal to `the number of data points / batch size`.
235-
This is useful in batch-based stochastic gradient descent algorithms to be optimizing
232+
The `MiniBatchContext` enables the computation of
233+
`log(prior) + s * log(likelihood of a batch)` when running the model, where `s` is the
234+
`loglike_scalar` field, typically equal to `the number of data points / batch size`.
235+
This is useful in batch-based stochastic gradient descent algorithms to be optimizing
236236
`log(prior) + log(likelihood of all the data points)` in the expectation.
237237
"""
238238
struct MiniBatchContext{Tctx,T} <: AbstractContext

src/model.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
f::F
44
args::NamedTuple{argnames,Targs}
55
defaults::NamedTuple{defaultnames,Tdefaults}
6-
context::Ctx
6+
context::Ctx=DefaultContext()
77
end
88
99
A `Model` struct with model evaluation function of type `F`, arguments of names `argnames`
@@ -1079,7 +1079,7 @@ end
10791079
Return an array of log joint probabilities evaluated at each sample in an MCMC `chain`.
10801080
10811081
# Examples
1082-
1082+
10831083
```jldoctest
10841084
julia> using MCMCChains, Distributions
10851085
@@ -1095,7 +1095,7 @@ julia> # construct a chain of samples using MCMCChains
10951095
chain = Chains(rand(10, 2, 3), [:s, :m]);
10961096
10971097
julia> logjoint(demo_model([1., 2.]), chain);
1098-
```
1098+
```
10991099
"""
11001100
function logjoint(model::Model, chain::AbstractMCMC.AbstractChains)
11011101
var_info = VarInfo(model) # extract variables info from the model
@@ -1126,7 +1126,7 @@ end
11261126
Return an array of log prior probabilities evaluated at each sample in an MCMC `chain`.
11271127
11281128
# Examples
1129-
1129+
11301130
```jldoctest
11311131
julia> using MCMCChains, Distributions
11321132
@@ -1142,7 +1142,7 @@ julia> # construct a chain of samples using MCMCChains
11421142
chain = Chains(rand(10, 2, 3), [:s, :m]);
11431143
11441144
julia> logprior(demo_model([1., 2.]), chain);
1145-
```
1145+
```
11461146
"""
11471147
function logprior(model::Model, chain::AbstractMCMC.AbstractChains)
11481148
var_info = VarInfo(model) # extract variables info from the model
@@ -1173,7 +1173,7 @@ end
11731173
Return an array of log likelihoods evaluated at each sample in an MCMC `chain`.
11741174
11751175
# Examples
1176-
1176+
11771177
```jldoctest
11781178
julia> using MCMCChains, Distributions
11791179
@@ -1189,7 +1189,7 @@ julia> # construct a chain of samples using MCMCChains
11891189
chain = Chains(rand(10, 2, 3), [:s, :m]);
11901190
11911191
julia> loglikelihood(demo_model([1., 2.]), chain);
1192-
```
1192+
```
11931193
"""
11941194
function Distributions.loglikelihood(model::Model, chain::AbstractMCMC.AbstractChains)
11951195
var_info = VarInfo(model) # extract variables info from the model

0 commit comments

Comments
 (0)