context_start_lineno
int64
1
913
line_no
int64
16
984
repo
stringclasses
5 values
id
int64
0
416
target_function_prompt
stringlengths
201
13.6k
function_signature
stringlengths
201
13.6k
solution_position
listlengths
2
2
raw_solution
stringlengths
201
13.6k
focal_code
stringlengths
201
13.6k
function_name
stringlengths
2
38
start_line
int64
1
913
end_line
int64
16
984
file_path
stringlengths
10
52
context
stringlengths
4.52k
9.85k
250
319
Turing.jl
400
function StatsBase.coeftable(m::ModeResult; level::Real=0.95, numerrors_warnonly::Bool=true) # Get columns for coeftable. terms = string.(StatsBase.coefnames(m)) estimates = m.values.array[:, 1] # If numerrors_warnonly is true, and if either the information matrix is singular or has # negative entri...
function StatsBase.coeftable(m::ModeResult; level::Real=0.95, numerrors_warnonly::Bool=true) # Get columns for coeftable. terms = string.(StatsBase.coefnames(m)) estimates = m.values.array[:, 1] # If numerrors_warnonly is true, and if either the information matrix is singular or has # negative entri...
[ 250, 319 ]
function StatsBase.coeftable(m::ModeResult; level::Real=0.95, numerrors_warnonly::Bool=true) # Get columns for coeftable. terms = string.(StatsBase.coefnames(m)) estimates = m.values.array[:, 1] # If numerrors_warnonly is true, and if either the information matrix is singular or has # negative entri...
function StatsBase.coeftable(m::ModeResult; level::Real=0.95, numerrors_warnonly::Bool=true) # Get columns for coeftable. terms = string.(StatsBase.coefnames(m)) estimates = m.values.array[:, 1] # If numerrors_warnonly is true, and if either the information matrix is singular or has # negative entri...
StatsBase.coeftable
250
319
src/optimisation/Optimisation.jl
#FILE: Turing.jl/test/optimisation/Optimisation.jl ##CHUNK 1 return y ~ MvNormal(a .* x .+ b .* x, 1) end model = collinear(xs, ys) mle_estimate = Turing.Optimisation.estimate_mode(model, MLE()) tab = coeftable(mle_estimate) @assert isnan(tab.cols[2][1]) @ass...
321
348
Turing.jl
401
function StatsBase.informationmatrix( m::ModeResult; hessian_function=ForwardDiff.hessian, kwargs... ) # Calculate Hessian and information matrix. # Convert the values to their unconstrained states to make sure the # Hessian is computed with respect to the untransformed parameters. linked = Dynamic...
function StatsBase.informationmatrix( m::ModeResult; hessian_function=ForwardDiff.hessian, kwargs... ) # Calculate Hessian and information matrix. # Convert the values to their unconstrained states to make sure the # Hessian is computed with respect to the untransformed parameters. linked = Dynamic...
[ 321, 348 ]
function StatsBase.informationmatrix( m::ModeResult; hessian_function=ForwardDiff.hessian, kwargs... ) # Calculate Hessian and information matrix. # Convert the values to their unconstrained states to make sure the # Hessian is computed with respect to the untransformed parameters. linked = Dynamic...
function StatsBase.informationmatrix( m::ModeResult; hessian_function=ForwardDiff.hessian, kwargs... ) # Calculate Hessian and information matrix. # Convert the values to their unconstrained states to make sure the # Hessian is computed with respect to the untransformed parameters. linked = Dynamic...
StatsBase.informationmatrix
321
348
src/optimisation/Optimisation.jl
#FILE: Turing.jl/ext/TuringOptimExt.jl ##CHUNK 1 kwargs..., ) # Convert the initial values, since it is assumed that users provide them # in the constrained space. # TODO(penelopeysm): As with in src/optimisation/Optimisation.jl, unclear # whether initialisation is really necessary at all vi = D...
364
383
Turing.jl
402
function Base.get(m::ModeResult, var_symbols::AbstractVector{Symbol}) log_density = m.f.ldf # Get all the variable names in the model. This is the same as the list of keys in # m.values, but they are more convenient to filter when they are VarNames rather than # Symbols. varnames = collect( ...
function Base.get(m::ModeResult, var_symbols::AbstractVector{Symbol}) log_density = m.f.ldf # Get all the variable names in the model. This is the same as the list of keys in # m.values, but they are more convenient to filter when they are VarNames rather than # Symbols. varnames = collect( ...
[ 364, 383 ]
function Base.get(m::ModeResult, var_symbols::AbstractVector{Symbol}) log_density = m.f.ldf # Get all the variable names in the model. This is the same as the list of keys in # m.values, but they are more convenient to filter when they are VarNames rather than # Symbols. varnames = collect( ...
function Base.get(m::ModeResult, var_symbols::AbstractVector{Symbol}) log_density = m.f.ldf # Get all the variable names in the model. This is the same as the list of keys in # m.values, but they are more convenient to filter when they are VarNames rather than # Symbols. varnames = collect( ...
getsym
364
383
src/optimisation/Optimisation.jl
#FILE: Turing.jl/src/mcmc/Inference.jl ##CHUNK 1 end function names_values(xs::AbstractVector{<:NamedTuple}) # Obtain all parameter names. names_set = Set{Symbol}() for x in xs for k in keys(x) push!(names_set, k) end end names_unique = collect(names_set) # Extract ...
450
469
Turing.jl
403
function generate_initial_params(model::DynamicPPL.Model, initial_params, constraints) if initial_params === nothing && has_generic_constraints(constraints) throw( ArgumentError( "You must provide an initial value when using generic constraints." ), ) end ...
function generate_initial_params(model::DynamicPPL.Model, initial_params, constraints) if initial_params === nothing && has_generic_constraints(constraints) throw( ArgumentError( "You must provide an initial value when using generic constraints." ), ) end ...
[ 450, 469 ]
function generate_initial_params(model::DynamicPPL.Model, initial_params, constraints) if initial_params === nothing && has_generic_constraints(constraints) throw( ArgumentError( "You must provide an initial value when using generic constraints." ), ) end ...
function generate_initial_params(model::DynamicPPL.Model, initial_params, constraints) if initial_params === nothing && has_generic_constraints(constraints) throw( ArgumentError( "You must provide an initial value when using generic constraints." ), ) end ...
generate_initial_params
450
469
src/optimisation/Optimisation.jl
#FILE: Turing.jl/src/mcmc/gibbs.jl ##CHUNK 1 # Get the initial values for this component sampler. initial_params_local = if initial_params === nothing nothing else DynamicPPL.subset(vi, varnames)[:] end # Construct the conditioned model. conditioned_model, context = make_condit...
487
505
Turing.jl
404
function Optimization.OptimizationProblem(log_density::OptimLogDensity, adtype, constraints) # Note that OptimLogDensity is a callable that evaluates the model with given # parameters. Hence we can use it in the objective function as below. f = Optimization.OptimizationFunction(log_density, adtype; cons=con...
function Optimization.OptimizationProblem(log_density::OptimLogDensity, adtype, constraints) # Note that OptimLogDensity is a callable that evaluates the model with given # parameters. Hence we can use it in the objective function as below. f = Optimization.OptimizationFunction(log_density, adtype; cons=con...
[ 487, 505 ]
function Optimization.OptimizationProblem(log_density::OptimLogDensity, adtype, constraints) # Note that OptimLogDensity is a callable that evaluates the model with given # parameters. Hence we can use it in the objective function as below. f = Optimization.OptimizationFunction(log_density, adtype; cons=con...
function Optimization.OptimizationProblem(log_density::OptimLogDensity, adtype, constraints) # Note that OptimLogDensity is a callable that evaluates the model with given # parameters. Hence we can use it in the objective function as below. f = Optimization.OptimizationFunction(log_density, adtype; cons=con...
Optimization.OptimizationProblem
487
505
src/optimisation/Optimisation.jl
#FILE: Turing.jl/ext/TuringOptimExt.jl ##CHUNK 1 _optimize(f::OptimLogDensity, optimizer=Optim.LBFGS(), args...; kwargs...) Estimate a mode, i.e., compute a MLE or MAP estimate. """ function _optimize( f::Optimisation.OptimLogDensity, init_vals::AbstractArray=DynamicPPL.getparams(f.ldf), optimizer::Opt...
539
595
Turing.jl
405
function estimate_mode( model::DynamicPPL.Model, estimator::ModeEstimator, solver=nothing; check_model::Bool=true, initial_params=nothing, adtype=ADTypes.AutoForwardDiff(), cons=nothing, lcons=nothing, ucons=nothing, lb=nothing, ub=nothing, kwargs..., ) check_model &&...
function estimate_mode( model::DynamicPPL.Model, estimator::ModeEstimator, solver=nothing; check_model::Bool=true, initial_params=nothing, adtype=ADTypes.AutoForwardDiff(), cons=nothing, lcons=nothing, ucons=nothing, lb=nothing, ub=nothing, kwargs..., ) check_model &&...
[ 539, 595 ]
function estimate_mode( model::DynamicPPL.Model, estimator::ModeEstimator, solver=nothing; check_model::Bool=true, initial_params=nothing, adtype=ADTypes.AutoForwardDiff(), cons=nothing, lcons=nothing, ucons=nothing, lb=nothing, ub=nothing, kwargs..., ) check_model &&...
function estimate_mode( model::DynamicPPL.Model, estimator::ModeEstimator, solver=nothing; check_model::Bool=true, initial_params=nothing, adtype=ADTypes.AutoForwardDiff(), cons=nothing, lcons=nothing, ucons=nothing, lb=nothing, ub=nothing, kwargs..., ) check_model &&...
estimate_mode
539
595
src/optimisation/Optimisation.jl
#FILE: Turing.jl/ext/TuringOptimExt.jl ##CHUNK 1 kwargs..., ) # Convert the initial values, since it is assumed that users provide them # in the constrained space. # TODO(penelopeysm): As with in src/optimisation/Optimisation.jl, unclear # whether initialisation is really necessary at all vi = D...
164
176
Turing.jl
406
function unsafe_logpdf_ordered_logistic(η, cutpoints, K, k::Int) @inbounds begin logp = if k == 1 -StatsFuns.log1pexp(η - cutpoints[k]) elseif k < K tmp = StatsFuns.log1pexp(cutpoints[k - 1] - η) -tmp + StatsFuns.log1mexp(tmp - StatsFuns.log1pexp(cutpoints[k] - η)...
function unsafe_logpdf_ordered_logistic(η, cutpoints, K, k::Int) @inbounds begin logp = if k == 1 -StatsFuns.log1pexp(η - cutpoints[k]) elseif k < K tmp = StatsFuns.log1pexp(cutpoints[k - 1] - η) -tmp + StatsFuns.log1mexp(tmp - StatsFuns.log1pexp(cutpoints[k] - η)...
[ 164, 176 ]
function unsafe_logpdf_ordered_logistic(η, cutpoints, K, k::Int) @inbounds begin logp = if k == 1 -StatsFuns.log1pexp(η - cutpoints[k]) elseif k < K tmp = StatsFuns.log1pexp(cutpoints[k - 1] - η) -tmp + StatsFuns.log1mexp(tmp - StatsFuns.log1pexp(cutpoints[k] - η)...
function unsafe_logpdf_ordered_logistic(η, cutpoints, K, k::Int) @inbounds begin logp = if k == 1 -StatsFuns.log1pexp(η - cutpoints[k]) elseif k < K tmp = StatsFuns.log1pexp(cutpoints[k - 1] - η) -tmp + StatsFuns.log1mexp(tmp - StatsFuns.log1pexp(cutpoints[k] - η)...
unsafe_logpdf_ordered_logistic
164
176
src/stdlib/distributions.jl
#FILE: Turing.jl/test/stdlib/distributions.jl ##CHUNK 1 @testset "distributions.jl" begin rng = StableRNG(12345) @testset "distributions functions" begin ns = 10 logitp = randn(rng) d1 = BinomialLogit(ns, logitp) d2 = Binomial(ns, logistic(logitp)) k = 3 @test lo...
133
156
Turing.jl
407
function _logpdf_table(d::DirichletProcess{T}, m::AbstractVector{Int}) where {T<:Real} # construct the table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or contains only zeros if iszero(m) table[...
function _logpdf_table(d::DirichletProcess{T}, m::AbstractVector{Int}) where {T<:Real} # construct the table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or contains only zeros if iszero(m) table[...
[ 133, 156 ]
function _logpdf_table(d::DirichletProcess{T}, m::AbstractVector{Int}) where {T<:Real} # construct the table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or contains only zeros if iszero(m) table[...
function _logpdf_table(d::DirichletProcess{T}, m::AbstractVector{Int}) where {T<:Real} # construct the table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or contains only zeros if iszero(m) table[...
_logpdf_table
133
156
src/stdlib/RandomMeasures.jl
#FILE: Turing.jl/src/stdlib/distributions.jl ##CHUNK 1 Base.maximum(::FlatPos) = Inf Base.rand(rng::Random.AbstractRNG, d::FlatPos) = rand(rng) + d.l function Distributions.logpdf(d::FlatPos, x::Real) z = float(zero(x)) return x <= d.l ? oftype(z, -Inf) : z end # For vec support function Distributions.loglikel...
218
233
Turing.jl
408
function stickbreak(v) K = length(v) + 1 cumprod_one_minus_v = cumprod(1 .- v) eta = [ if k == 1 v[1] elseif k == K cumprod_one_minus_v[K - 1] else v[k] * cumprod_one_minus_v[k - 1] end for k in 1:K ] return eta end
function stickbreak(v) K = length(v) + 1 cumprod_one_minus_v = cumprod(1 .- v) eta = [ if k == 1 v[1] elseif k == K cumprod_one_minus_v[K - 1] else v[k] * cumprod_one_minus_v[k - 1] end for k in 1:K ] return eta end
[ 218, 233 ]
function stickbreak(v) K = length(v) + 1 cumprod_one_minus_v = cumprod(1 .- v) eta = [ if k == 1 v[1] elseif k == K cumprod_one_minus_v[K - 1] else v[k] * cumprod_one_minus_v[k - 1] end for k in 1:K ] return eta end
function stickbreak(v) K = length(v) + 1 cumprod_one_minus_v = cumprod(1 .- v) eta = [ if k == 1 v[1] elseif k == K cumprod_one_minus_v[K - 1] else v[k] * cumprod_one_minus_v[k - 1] end for k in 1:K ] return eta end
stickbreak
218
233
src/stdlib/RandomMeasures.jl
#FILE: Turing.jl/test/stdlib/RandomMeasures.jl ##CHUNK 1 # # Infinite (truncated) collection of breaking points on unit stick. # v = tzeros(Float64, trunc) # # Cluster locations. # x = tzeros(Float64, trunc) # # Draw weights and locations. # for...
242
267
Turing.jl
409
function _logpdf_table(d::PitmanYorProcess{T}, m::AbstractVector{Int}) where {T<:Real} # sanity check @assert d.t == sum(!iszero, m) # construct table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or c...
function _logpdf_table(d::PitmanYorProcess{T}, m::AbstractVector{Int}) where {T<:Real} # sanity check @assert d.t == sum(!iszero, m) # construct table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or c...
[ 242, 267 ]
function _logpdf_table(d::PitmanYorProcess{T}, m::AbstractVector{Int}) where {T<:Real} # sanity check @assert d.t == sum(!iszero, m) # construct table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or c...
function _logpdf_table(d::PitmanYorProcess{T}, m::AbstractVector{Int}) where {T<:Real} # sanity check @assert d.t == sum(!iszero, m) # construct table first_zero = findfirst(iszero, m) K = first_zero === nothing ? length(m) + 1 : length(m) table = fill(T(-Inf), K) # exit if m is empty or c...
_logpdf_table
242
267
src/stdlib/RandomMeasures.jl
#FILE: Turing.jl/src/stdlib/distributions.jl ##CHUNK 1 Base.maximum(::FlatPos) = Inf Base.rand(rng::Random.AbstractRNG, d::FlatPos) = rand(rng) + d.l function Distributions.logpdf(d::FlatPos, x::Real) z = float(zero(x)) return x <= d.l ? oftype(z, -Inf) : z end # For vec support function Distributions.loglikel...
16
27
Turing.jl
410
function ADVI( samples_per_step::Int=1, max_iters::Int=1000; adtype::ADTypes.AbstractADType=ADTypes.AutoForwardDiff(), ) Base.depwarn( "The type ADVI will be removed in future releases. Please refer to the new interface for `vi`", :ADVI; force=true, ) return ADVI{typeof(a...
function ADVI( samples_per_step::Int=1, max_iters::Int=1000; adtype::ADTypes.AbstractADType=ADTypes.AutoForwardDiff(), ) Base.depwarn( "The type ADVI will be removed in future releases. Please refer to the new interface for `vi`", :ADVI; force=true, ) return ADVI{typeof(a...
[ 16, 27 ]
function ADVI( samples_per_step::Int=1, max_iters::Int=1000; adtype::ADTypes.AbstractADType=ADTypes.AutoForwardDiff(), ) Base.depwarn( "The type ADVI will be removed in future releases. Please refer to the new interface for `vi`", :ADVI; force=true, ) return ADVI{typeof(a...
function ADVI( samples_per_step::Int=1, max_iters::Int=1000; adtype::ADTypes.AbstractADType=ADTypes.AutoForwardDiff(), ) Base.depwarn( "The type ADVI will be removed in future releases. Please refer to the new interface for `vi`", :ADVI; force=true, ) return ADVI{typeof(a...
ADVI
16
27
src/variational/deprecated.jl
#FILE: Turing.jl/src/mcmc/external_sampler.jl ##CHUNK 1 return Unconstrained end """ externalsampler(sampler::AbstractSampler; adtype=AutoForwardDiff(), unconstrained=true) Wrap a sampler so it can be used as an inference algorithm. # Arguments - `sampler::AbstractSampler`: The sampler to wrap. # Keyword Ar...
29
42
Turing.jl
411
function vi(model::DynamicPPL.Model, alg::ADVI; kwargs...) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", :vi; force=true, ) q = q_meanfield_gaussian(Random.default_rng(), model) ...
function vi(model::DynamicPPL.Model, alg::ADVI; kwargs...) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", :vi; force=true, ) q = q_meanfield_gaussian(Random.default_rng(), model) ...
[ 29, 42 ]
function vi(model::DynamicPPL.Model, alg::ADVI; kwargs...) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", :vi; force=true, ) q = q_meanfield_gaussian(Random.default_rng(), model) ...
function vi(model::DynamicPPL.Model, alg::ADVI; kwargs...) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", :vi; force=true, ) q = q_meanfield_gaussian(Random.default_rng(), model) ...
vi
29
42
src/variational/deprecated.jl
#FILE: Turing.jl/src/variational/VariationalInference.jl ##CHUNK 1 - `q_avg`: Variational distribution formed by the averaged iterates according to `averager`. - `state`: Collection of states used for optimization. This can be used to resume from a past call to `vi`. - `info`: Information generated during the optimizat...
44
61
Turing.jl
412
function vi( model::DynamicPPL.Model, alg::ADVI, q::Bijectors.TransformedDistribution{<:DistributionsAD.TuringDiagMvNormal}; kwargs..., ) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", ...
function vi( model::DynamicPPL.Model, alg::ADVI, q::Bijectors.TransformedDistribution{<:DistributionsAD.TuringDiagMvNormal}; kwargs..., ) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", ...
[ 44, 61 ]
function vi( model::DynamicPPL.Model, alg::ADVI, q::Bijectors.TransformedDistribution{<:DistributionsAD.TuringDiagMvNormal}; kwargs..., ) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", ...
function vi( model::DynamicPPL.Model, alg::ADVI, q::Bijectors.TransformedDistribution{<:DistributionsAD.TuringDiagMvNormal}; kwargs..., ) Base.depwarn( "This specialization along with the type `ADVI` will be deprecated in future releases. Please refer to the new interface for `vi`.", ...
vi
44
61
src/variational/deprecated.jl
#FILE: Turing.jl/src/variational/VariationalInference.jl ##CHUNK 1 - `q_avg`: Variational distribution formed by the averaged iterates according to `averager`. - `state`: Collection of states used for optimization. This can be used to resume from a past call to `vi`. - `info`: Information generated during the optimizat...
130
170
Turing.jl
413
function q_locationscale( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal,<:LowerTriangular}=nothing, meanfield::Bool=true, basedist::Distributions.UnivariateDistribution=Normal(), kwargs..., ) varinfo =...
function q_locationscale( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal,<:LowerTriangular}=nothing, meanfield::Bool=true, basedist::Distributions.UnivariateDistribution=Normal(), kwargs..., ) varinfo =...
[ 130, 170 ]
function q_locationscale( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal,<:LowerTriangular}=nothing, meanfield::Bool=true, basedist::Distributions.UnivariateDistribution=Normal(), kwargs..., ) varinfo =...
function q_locationscale( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal,<:LowerTriangular}=nothing, meanfield::Bool=true, basedist::Distributions.UnivariateDistribution=Normal(), kwargs..., ) varinfo =...
q_locationscale
130
170
src/variational/VariationalInference.jl
#CURRENT FILE: Turing.jl/src/variational/VariationalInference.jl ##CHUNK 1 function q_initialize_scale( rng::Random.AbstractRNG, model::DynamicPPL.Model, location::AbstractVector, scale::AbstractMatrix, basedist::Distributions.UnivariateDistribution; num_samples::Int=10, num_max_trials::Int=...
199
209
Turing.jl
414
function q_meanfield_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=true, basedist=Normal(), kwargs... ...
function q_meanfield_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=true, basedist=Normal(), kwargs... ...
[ 199, 209 ]
function q_meanfield_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=true, basedist=Normal(), kwargs... ...
function q_meanfield_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=true, basedist=Normal(), kwargs... ...
q_meanfield_gaussian
199
209
src/variational/VariationalInference.jl
#CURRENT FILE: Turing.jl/src/variational/VariationalInference.jl ##CHUNK 1 function q_locationscale(model::DynamicPPL.Model; kwargs...) return q_locationscale(Random.default_rng(), model; kwargs...) end """ q_meanfield_gaussian( [rng::Random.AbstractRNG,] model::DynamicPPL.Model; locat...
238
248
Turing.jl
415
function q_fullrank_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:LowerTriangular}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=false, basedist=Normal(), kwargs...
function q_fullrank_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:LowerTriangular}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=false, basedist=Normal(), kwargs...
[ 238, 248 ]
function q_fullrank_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:LowerTriangular}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=false, basedist=Normal(), kwargs...
function q_fullrank_gaussian( rng::Random.AbstractRNG, model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:LowerTriangular}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=false, basedist=Normal(), kwargs...
q_fullrank_gaussian
238
248
src/variational/VariationalInference.jl
#CURRENT FILE: Turing.jl/src/variational/VariationalInference.jl ##CHUNK 1 model::DynamicPPL.Model; location::Union{Nothing,<:AbstractVector}=nothing, scale::Union{Nothing,<:Diagonal}=nothing, kwargs..., ) return q_locationscale( rng, model; location, scale, meanfield=true, basedist=Normal()...
295
323
Turing.jl
416
function vi( rng::Random.AbstractRNG, model::DynamicPPL.Model, q, n_iterations::Int; objective=AdvancedVI.RepGradELBO( 10; entropy=AdvancedVI.ClosedFormEntropyZeroGradient() ), show_progress::Bool=PROGRESS[], optimizer=AdvancedVI.DoWG(), averager=AdvancedVI.PolynomialAveragin...
function vi( rng::Random.AbstractRNG, model::DynamicPPL.Model, q, n_iterations::Int; objective=AdvancedVI.RepGradELBO( 10; entropy=AdvancedVI.ClosedFormEntropyZeroGradient() ), show_progress::Bool=PROGRESS[], optimizer=AdvancedVI.DoWG(), averager=AdvancedVI.PolynomialAveragin...
[ 295, 323 ]
function vi( rng::Random.AbstractRNG, model::DynamicPPL.Model, q, n_iterations::Int; objective=AdvancedVI.RepGradELBO( 10; entropy=AdvancedVI.ClosedFormEntropyZeroGradient() ), show_progress::Bool=PROGRESS[], optimizer=AdvancedVI.DoWG(), averager=AdvancedVI.PolynomialAveragin...
function vi( rng::Random.AbstractRNG, model::DynamicPPL.Model, q, n_iterations::Int; objective=AdvancedVI.RepGradELBO( 10; entropy=AdvancedVI.ClosedFormEntropyZeroGradient() ), show_progress::Bool=PROGRESS[], optimizer=AdvancedVI.DoWG(), averager=AdvancedVI.PolynomialAveragin...
vi
295
323
src/variational/VariationalInference.jl
#FILE: Turing.jl/test/variational/advi.jl ##CHUNK 1 ), ( "ADVI with STL entropy", AdvancedVI.RepGradELBO(10; entropy=AdvancedVI.StickingTheLandingEntropy()), AdvancedVI.ClipScale(), AdvancedVI.DoG(), ), ] T = 1000 q, q_avg, _, _...