DistributionUtils
CalibrateEDMF.DistributionUtils.construct_priors
— Functionconstruct_priors(
const_dict::Dict{String, T};
unconstrained_σ::FT = 1.0,
prior_mean::Union{Dict{String, Vector{Float64}}, Nothing} = nothing,
outdir_path::String = pwd(),
to_file::Bool = true,
) where {T, FT}
Define a prior Gaussian ParameterDistribution in unconstrained space from a dictionary of constraints.
This constructor assumes independent priors and the same unconstrained standard deviation for each parameter. Note that the standard deviation in unconstrained space is normalized with respect to the constrained interval width, so it automatically takes into account parameter scales.
The constructor also allows passing a prior mean for each parameter in constrained space.
Inputs:
- const_dict :: Dictionary of parameter names to constraints.
- unconstrained_σ :: Standard deviation of the transformed gaussians (unconstrained space) or a dictionary mapping parameter names to standard deviations in unconstrained space.
- prior_mean :: The mean value of the prior in constrained space. If not given, the prior is selected to be 0 in the centered unconstrained space.
- outdir_path :: Output path.
- to_file :: Whether to write the serialized prior to a JLD2 file.
Output:
- The prior ParameterDistribution.
CalibrateEDMF.DistributionUtils.construct_prior
— Functionconstruct_prior(
param_name::String,
constraint::Vector{CT},
prior_μ::OptVec{FT},
unconstrained_σ,
) where {CT, FT <: Real}
Define a prior Gaussian ParameterDistribution in unconstrained space from a constraint, a prior in constrained space, and the standard deviation in unconstrained space.
The standard deviation in unconstrained space is normalized with respect to the constrained interval width, so it automatically takes into account parameter scales.
Inputs:
- param_name :: A parameter name.
- constraint :: A 1-element vector containing the constraints.
- prior_μ :: A 1-element vector containing the constrained prior mean.
- unconstrained_σ :: Standard deviation of the transformed gaussians (unconstrained space).
Output:
- The prior ParameterDistribution.
CalibrateEDMF.DistributionUtils.flatten_config_dict
— Functionflatten_config_dict(param_dict::Dict{String, Vector{T}})
Given a dictionary of parameter names => parameter vectors of arbitrary length, return a pair of vectors (name, values) with vector components as unique parameters.
Inputs:
- param_dict :: Dictionary of parameter names to constraints.
Outputs:
- u_names :: Vector{String} :: vector of parameter names
- values :: Vector{Vector{T}} :: vector of single-valued vectors encapsulating parameter values.
CalibrateEDMF.DistributionUtils.flat_dict_keys_where
— Functionflat_dict_keys_where(dict::Dict{String, Vector{T}}, condition::Function = identity) where {T}
Flattens the values of a dictionary with parameter vectors as keys, and returns the indices of entries in the flattened dictionary satisfying a given condition.
Inputs: param_dict :: Dictionary of parameter names to vectors. condition :: A condition function operating on each dictionary value. Outputs: Indices of flattened entries satisfying the condition
.
CalibrateEDMF.DistributionUtils.logmean_and_logstd
— Functionlogmean_and_logstd(μ, σ)
Returns the lognormal parameters μ and σ from the mean μ and std σ of the lognormal distribution.
CalibrateEDMF.DistributionUtils.mean_and_std_from_ln
— Functionmean_and_std_from_ln(μ, σ)
Returns the mean and variance of the lognormal distribution from the lognormal parameters μ and σ.