Skip to content

Commit

Permalink
doc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ParadaCarleton committed Sep 17, 2021
1 parent 41d55c5 commit 75d5e9c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
5 changes: 5 additions & 0 deletions src/InternalHelpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ of that point. This function must take the form `f(θ[1], ..., θ[n], data)`, wh
parameter vector. See also the `splat` keyword argument.
"""

const LIKELIHOOD_ARRAY_ARG = """
`log_likelihood::Array`: A matrix or 3d array of log-likelihood values indexed as
`[data, step, chain]`. See the `chain_index` argument if leaving the `chain` index off.
"""

const R_EFF_DOC = """
`r_eff::AbstractVector`: An (optional) vector of relative effective sample sizes used in ESS
calculations. If left empty, calculated automatically using the FFTESS method from
Expand Down
12 changes: 4 additions & 8 deletions src/LeaveOneOut.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ score.
# Arguments
- `log_likelihood::Array`: A matrix or 3d array of log-likelihood values indexed as
`[data, step, chain]`. The chain argument can be left off if `chain_index` is provided
or if all posterior samples were drawn from a single chain.
- $LIKELIHOOD_ARRAY_ARG
- $ARGS [`psis`](@ref).
- $CHAIN_INDEX_DOC
- $KWARGS [`psis`](@ref).
Expand Down Expand Up @@ -135,11 +133,9 @@ Use a precalculated `Psis` object to estimate the leave-one-out cross validation
# Arguments
- `log_likelihood::Array`: A matrix or 3d array of log-likelihood values indexed as
`[data, step, chain]`. The chain argument can be left off if `chain_index` is provided
or if all posterior samples were drawn from a single chain.
- `psis_object`: A precomputed `Psis` object used to estimate the LOO-CV score.
- $CHAIN_INDEX_DOC
- $LIKELIHOOD_ARRAY_ARG
- `psis_object`: A precomputed `Psis` object used to estimate the LOO-CV score.
- $CHAIN_INDEX_DOC
See also: [`psis`](@ref), [`loo`](@ref), [`PsisLoo`](@ref).
Expand Down
11 changes: 4 additions & 7 deletions src/ModelComparison.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import Base.show

export loo_compare, ModelComparison

const LOO_COMPARE_KWARGS = """
- `model_names`: A vector or tuple of strings or symbols used to identify models. If
none, models are numbered using the order of the arguments.
- `sort_models`: Sort models by total score.
- `high_to_low`: Sort models from best to worst score. If `false`, reverse the order.
"""

"""
ModelComparison
Expand Down Expand Up @@ -65,7 +59,10 @@ Construct a model comparison table from several [`PsisLoo`](@ref) objects.
- `cv_results`: One or more [`PsisLoo`](@ref) objects to be compared. Alternatively,
a tuple or named tuple of `PsisLoo` objects can be passed. If a named tuple is passed,
these names will be used to label each model.
- $LOO_COMPARE_KWARGS
- `model_names`: A vector or tuple of strings or symbols used to identify models. If
none, models are numbered using the order of the arguments.
- `sort_models`: Sort models by total score.
- `high_to_low`: Sort models from best to worst score. If `false`, reverse the order.
See also: [`ModelComparison`](@ref), [`PsisLoo`](@ref), [`psis_loo`](@ref)
"""
Expand Down
7 changes: 6 additions & 1 deletion src/NaiveLPD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ using Tullio


"""
$(TYPEDSIGNATURES)
naive_lpd(log_likelihood::AbstractArray{<:Real}, chain_index::Vector}<:Int)
Calculate the naive (in-sample) estimate of the expected log probability density, otherwise
known as the in-sample Bayes score. Not recommended for most uses.
# Arguments
- $LIKELIHOOD_ARRAY_ARG
- $CHAIN_INDEX_DOC
"""
function naive_lpd(log_likelihood::AbstractArray{<:Real, 3})
@info "We advise against using `naive_lpd`, as it gives inconsistent and strongly " *
Expand All @@ -18,6 +22,7 @@ function naive_lpd(
log_likelihood::AbstractMatrix{<:Real},
chain_index::AbstractVector{<:Integer} = _assume_one_chain(log_likelihood)
)
@nospecialize(chain_index)
log_likelihood = _convert_to_array(log_likelihood, chain_index)
return _naive_lpd(log_likelihood)
end
Expand Down

0 comments on commit 75d5e9c

Please sign in to comment.