Skip to content

Conversation

sunxd3
Copy link
Member

@sunxd3 sunxd3 commented Aug 23, 2025

No description provided.

Copy link
Contributor

JuliaBUGS.jl documentation for PR #385 is available at:
https://TuringLang.github.io/JuliaBUGS.jl/previews/PR385/

Copy link

codecov bot commented Aug 23, 2025

Codecov Report

❌ Patch coverage is 88.75740% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.64%. Comparing base (53fd7bb) to head (f6002b3).

Files with missing lines Patch % Lines
JuliaBUGS/src/model/evaluation.jl 84.79% 33 Missing ⚠️
JuliaBUGS/src/model/bugsmodel.jl 97.77% 2 Missing ⚠️
JuliaBUGS/src/model/logdensityproblems.jl 90.00% 2 Missing ⚠️
JuliaBUGS/src/model/abstractppl.jl 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #385      +/-   ##
==========================================
+ Coverage   83.26%   83.64%   +0.37%     
==========================================
  Files          31       31              
  Lines        3759     4066     +307     
==========================================
+ Hits         3130     3401     +271     
- Misses        629      665      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶

println("[FrontierCacheTest] Computing minimal keys (states-first)..."); flush(stdout)


[JuliaFormatter] reported by reviewdog 🐶

println("[FrontierCacheTest] Evaluating logp with interleaved order..."); flush(stdout)


[JuliaFormatter] reported by reviewdog 🐶

println("[FrontierCacheTest] Evaluating logp with states-first order..."); flush(stdout)


[JuliaFormatter] reported by reviewdog 🐶

println("[FrontierCacheTest] Done evaluations, comparing..."); flush(stdout)

sunxd3 and others added 11 commits August 29, 2025 15:22
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

github-actions bot commented Sep 2, 2025

Benchmark results on macOS (aarch64)

BridgeStan not found at location specified by $BRIDGESTAN environment variable, downloading version 2.6.2 to /Users/runner/.bridgestan/bridgestan-2.6.2
Done!

Stan results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 5.5084 8.014
pumps 12 0.901031 1.04
bones 13 81.416 92.709
oxford 244 10.479 13.041
epil 303 34.709 42.4585
lsat 1006 110.0 159.417
schools 133 245.792 389.438
beetles 2 0.745958 0.861133
air 5 0.909935 1.01696

JuliaBUGS Mooncake results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 1.22646 7.59733
pumps 12 0.463379 1.83336
bones 33 49.291 272.666
oxford 244 19.834 55.791
epil 303 7.44433 36.792
lsat 1006 51.209 224.125
schools 133 113.271 811.375
beetles 2 0.872485 3.82812
air 5 0.263636 1.14668

Benchmark results on Ubuntu (x64)

BridgeStan not found at location specified by $BRIDGESTAN environment variable, downloading version 2.6.2 to /home/runner/.bridgestan/bridgestan-2.6.2
Done!

Stan results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 5.1616 7.544
pumps 12 0.959133 1.14135
bones 13 70.651 88.094
oxford 244 14.3365 18.365
epil 303 28.994 35.536
lsat 1006 161.811 204.375
schools 133 552.785 789.442
beetles 2 0.844529 0.980167
air 5 0.656909 0.802333

JuliaBUGS Mooncake results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 1.9336 13.7505
pumps 12 0.597857 2.49736
bones 33 48.14 366.894
oxford 244 23.694 74.759
epil 303 10.8205 55.212
lsat 1006 89.957 364.499
schools 133 104.359 1082.84
beetles 2 1.08704 4.73217
air 5 0.339368 1.30624

cursor[bot]

This comment was marked as spam.

@TuringLang TuringLang deleted a comment from cursor bot Sep 23, 2025
@coveralls
Copy link

coveralls commented Sep 23, 2025

Pull Request Test Coverage Report for Build 17946143376

Details

  • 300 of 338 (88.76%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 83.645%

Changes Missing Coverage Covered Lines Changed/Added Lines %
JuliaBUGS/src/model/abstractppl.jl 10 11 90.91%
JuliaBUGS/src/model/bugsmodel.jl 88 90 97.78%
JuliaBUGS/src/model/logdensityproblems.jl 18 20 90.0%
JuliaBUGS/src/model/evaluation.jl 184 217 84.79%
Totals Coverage Status
Change from base Build 17946015706: 0.4%
Covered Lines: 3401
Relevant Lines: 4066

💛 - Coveralls

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶

logp, logp_ref = run_case(K=K, T=T, seed=seed)


[JuliaFormatter] reported by reviewdog 🐶

eps = try parse(Float64, get(ENV, "AGC_EPS", "1e-5")) catch; 1e-5 end


[JuliaFormatter] reported by reviewdog 🐶

sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means_true, sigmas=sigmas_true)


[JuliaFormatter] reported by reviewdog 🐶

mu_prior_mean, mu_prior_std, logsigma_prior_mean, logsigma_prior_std = priors_from_truth(means_true, sigmas_true)


[JuliaFormatter] reported by reviewdog 🐶

T = T,
K = K,
y = sim.y,
init_probs = init_probs,
transition = transition,
mu_prior_mean = mu_prior_mean,
mu_prior_std = mu_prior_std,
logsigma_prior_mean = logsigma_prior_mean,
logsigma_prior_std = logsigma_prior_std,


[JuliaFormatter] reported by reviewdog 🐶

logp, max_abs_diff, max_rel_diff = run_case(seed, K, T; ϵ=eps, verbose=(verbose && is_single))


[JuliaFormatter] reported by reviewdog 🐶

rng = MersenneTwister(get(ENV, "AM_SEED", "1") |> x -> parse(Int, x))
T = get(ENV, "AM_T", "50") |> x -> parse(Int, x)


[JuliaFormatter] reported by reviewdog 🐶

sim = simulate_hmm(rng, T; init_probs=init_probs, transition=transition, means=means, sigmas=sigmas)


[JuliaFormatter] reported by reviewdog 🐶

T = T,
K = K,
y = sim.obs,
init_probs = init_probs,
transition = transition,
means = means,
sigmas = sigmas,


[JuliaFormatter] reported by reviewdog 🐶

trials = try parse(Int, get(ENV, "AS_TRIALS", "5")) catch; 5 end


[JuliaFormatter] reported by reviewdog 🐶

function simulate_hmm(rng::AbstractRNG, T::Int, K::Int; init_probs, transition, means, sigmas)


[JuliaFormatter] reported by reviewdog 🐶

sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means, sigmas=sigmas)


[JuliaFormatter] reported by reviewdog 🐶

T = T,
K = K,
y = sim.obs,
init_probs = init_probs,
transition = transition,
means = means,
sigmas = sigmas,


[JuliaFormatter] reported by reviewdog 🐶

mean_time, logp, max_f, mean_f, sum_f = bench_case(K=K, T=T, seed=seed, trials=trials)


[JuliaFormatter] reported by reviewdog 🐶

B = try parse(Int, get(ENV, "AHMT_B", "2")) catch; 2 end
depth = try parse(Int, get(ENV, "AHMT_DEPTH", "8")) catch; 8 end
K = try parse(Int, get(ENV, "AHMT_K", "4")) catch; 4 end
seed = try parse(Int, get(ENV, "AHMT_SEED", "1")) catch; 1 end
trials = try parse(Int, get(ENV, "AHMT_TRIALS", "10")) catch; 10 end


[JuliaFormatter] reported by reviewdog 🐶

cost_thresh = try parse(Float64, get(ENV, "AHMT_COST_THRESH", "1.0e8")) catch; 1.0e8 end


[JuliaFormatter] reported by reviewdog 🐶

function simulate_hmt(rng::AbstractRNG, B::Int, depth::Int, K::Int; init_probs, transition, means, sigmas)


[JuliaFormatter] reported by reviewdog 🐶

sim = simulate_hmt(rng, B, depth, K; init_probs=init_probs, transition=transition, means=means, sigmas=sigmas)


[JuliaFormatter] reported by reviewdog 🐶

B = B,
depth = depth,
N = N,
K = K,
y = sim.y,
init_probs = init_probs,
transition = transition,
means = means,
sigmas = sigmas,
parent = parent,


[JuliaFormatter] reported by reviewdog 🐶

"dfs" => () -> make_model_with_order(model, build_hmt_dfs_order(model; B_hint=B)),
"bfs" => () -> make_model_with_order(model, build_hmt_bfs_order(model)),
"random_dfs" => () -> make_model_with_order(model, build_hmt_dfs_order(model; B_hint=B, rng=MersenneTwister(seed+1), randomized=true)),
"min_fill" => () -> make_model_with_order(model, build_min_fill_order(model; rng=MersenneTwister(seed+2), num_restarts=3)),
"min_degree" => () -> make_model_with_order(model, build_min_degree_order(model; rng=MersenneTwister(seed+3), num_restarts=3)),


[JuliaFormatter] reported by reviewdog 🐶

) (
isnan(logp) ? "NA" : @sprintf("%.12f", logp)
)


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end
if i > 0; z_idxs[i] = j; else; push!(other, j); end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end
if i > 0; y_idxs[i] = j; else; push!(other, j); end


[JuliaFormatter] reported by reviewdog 🐶

if yi != 0; push!(order, yi); end


[JuliaFormatter] reported by reviewdog 🐶

inner = replace(s[3:end-1], " " => "")


[JuliaFormatter] reported by reviewdog 🐶

c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

inner = replace(s[3:end-1], " " => "")


[JuliaFormatter] reported by reviewdog 🐶

c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

if placed[i]; return; end


[JuliaFormatter] reported by reviewdog 🐶

ps = [p for p in st_parents[j] if gd.is_discrete_finite_vals[p] && !gd.is_observed_vals[p]]


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

gd2 = JModel.GraphEvaluationData{typeof(gd.node_function_vals),typeof(gd.loop_vars_vals)}(


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

inner = replace(s[3:end-1], " " => "")


[JuliaFormatter] reported by reviewdog 🐶

c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

if gd.is_discrete_finite_vals[i] && !gd.is_observed_vals[i] && gd.is_stochastic_vals[i]


[JuliaFormatter] reported by reviewdog 🐶

for k in (i+1):length(disc_parents)


[JuliaFormatter] reported by reviewdog 🐶

for j in (i+1):length(neighbors_vec)


[JuliaFormatter] reported by reviewdog 🐶

for j in (i+1):length(neighbors_vec)


[JuliaFormatter] reported by reviewdog 🐶

test_model = make_model_with_order(model, build_eval_order_from_discrete_order(model, order))


[JuliaFormatter] reported by reviewdog 🐶

test_model = make_model_with_order(model, build_eval_order_from_discrete_order(model, order))


[JuliaFormatter] reported by reviewdog 🐶

@warn "Failed to precompute auto-marginalization caches; falling back to graph evaluation" exception=(err, catch_backtrace())


[JuliaFormatter] reported by reviewdog 🐶

branch_loglikelihoods = Vector{typeof(lik_val)}(undef, length(possible_values))


[JuliaFormatter] reported by reviewdog 🐶

log_joint_total = LogExpFunctions.logsumexp(total_logpriors .+ branch_loglikelihoods)


[JuliaFormatter] reported by reviewdog 🐶

data = (
K=2,
w=[0.3, 0.7],
delta=[0.0, 2.0],
sigma=1.0,
y=1.5,
)

Comment on lines +17 to +21
C = try parse(Int, get(ENV, "AFH_C", "2")) catch; 2 end
K = try parse(Int, get(ENV, "AFH_K", "4")) catch; 4 end
T = try parse(Int, get(ENV, "AFH_T", "100")) catch; 100 end
seed = try parse(Int, get(ENV, "AFH_SEED", "1")) catch; 1 end
trials = try parse(Int, get(ENV, "AFH_TRIALS", "10")) catch; 10 end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
C = try parse(Int, get(ENV, "AFH_C", "2")) catch; 2 end
K = try parse(Int, get(ENV, "AFH_K", "4")) catch; 4 end
T = try parse(Int, get(ENV, "AFH_T", "100")) catch; 100 end
seed = try parse(Int, get(ENV, "AFH_SEED", "1")) catch; 1 end
trials = try parse(Int, get(ENV, "AFH_TRIALS", "10")) catch; 10 end
C = try
parse(Int, get(ENV, "AFH_C", "2"))
catch
; 2
end
K = try
parse(Int, get(ENV, "AFH_K", "4"))
catch
; 4
end
T = try
parse(Int, get(ENV, "AFH_T", "100"))
catch
; 100
end
seed = try
parse(Int, get(ENV, "AFH_SEED", "1"))
catch
; 1
end
trials = try
parse(Int, get(ENV, "AFH_TRIALS", "10"))
catch
; 10
end

seed = try parse(Int, get(ENV, "AFH_SEED", "1")) catch; 1 end
trials = try parse(Int, get(ENV, "AFH_TRIALS", "10")) catch; 10 end
mode = lowercase(get(ENV, "AFH_MODE", "frontier")) # frontier | timed
cost_thresh = try parse(Float64, get(ENV, "AFH_COST_THRESH", "1.0e8")) catch; 1.0e8 end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
cost_thresh = try parse(Float64, get(ENV, "AFH_COST_THRESH", "1.0e8")) catch; 1.0e8 end
cost_thresh = try
parse(Float64, get(ENV, "AFH_COST_THRESH", "1.0e8"))
catch
; 1.0e8
end

return init_probs, transition, mu, sigma_y
end

function simulate_fhmm(rng::AbstractRNG, C::Int, K::Int, T::Int; init_probs, transition, mu, sigma_y)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
function simulate_fhmm(rng::AbstractRNG, C::Int, K::Int, T::Int; init_probs, transition, mu, sigma_y)
function simulate_fhmm(
rng::AbstractRNG, C::Int, K::Int, T::Int; init_probs, transition, mu, sigma_y
)

# Simulate data
rng = MersenneTwister(seed)
init_probs, transition, mu, sigma_y = default_fhmm_params(C, K)
sim = simulate_fhmm(rng, C, K, T; init_probs=init_probs, transition=transition, mu=mu, sigma_y=sigma_y)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
sim = simulate_fhmm(rng, C, K, T; init_probs=init_probs, transition=transition, mu=mu, sigma_y=sigma_y)
sim = simulate_fhmm(
rng, C, K, T; init_probs=init_probs, transition=transition, mu=mu, sigma_y=sigma_y
)

Comment on lines +108 to +115
C = C,
K = K,
T = T,
y = sim.y,
init_probs = init_probs,
transition = transition,
mu = mu,
sigma_y = sigma_y,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
C = C,
K = K,
T = T,
y = sim.y,
init_probs = init_probs,
transition = transition,
mu = mu,
sigma_y = sigma_y,
C=C,
K=K,
T=T,
y=sim.y,
init_probs=init_probs,
transition=transition,
mu=mu,
sigma_y=sigma_y,

Comment on lines +165 to +174
T = T,
K = K,
y = y,
alpha = α,
gamma = γ,
kappa = κ,
mu0 = m0,
mu0_std = s0,
logsigma0 = ℓ0,
logsigma0_std = τ0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
T = T,
K = K,
y = y,
alpha = α,
gamma = γ,
kappa = κ,
mu0 = m0,
mu0_std = s0,
logsigma0 = ℓ0,
logsigma0_std = τ0,
T=T,
K=K,
y=y,
alpha=α,
gamma=γ,
kappa=κ,
mu0=m0,
mu0_std=s0,
logsigma0=ℓ0,
logsigma0_std=τ0,

end

for seed in seeds, K in Ks, T in Ts
logp, max_abs_diff, max_rel_diff = run_case(seed, K, T; α=alpha, γ=gamma, κ=kappa, ϵ=eps, verbose=(verbose && is_single))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
logp, max_abs_diff, max_rel_diff = run_case(seed, K, T; α=alpha, γ=gamma, κ=kappa, ϵ=eps, verbose=(verbose && is_single))
logp, max_abs_diff, max_rel_diff = run_case(
seed, K, T; α=alpha, γ=gamma, κ=kappa, ϵ=eps, verbose=(verbose && is_single)
)

using LogDensityProblems
using LogExpFunctions: logsumexp

function simulate_hmm(rng::AbstractRNG, T::Int, K::Int; init_probs, transition, means, sigmas)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
function simulate_hmm(rng::AbstractRNG, T::Int, K::Int; init_probs, transition, means, sigmas)
function simulate_hmm(
rng::AbstractRNG, T::Int, K::Int; init_probs, transition, means, sigmas
)

function run_case(; K::Int, T::Int, seed::Int)
rng = MersenneTwister(seed)
init_probs, transition, means, sigmas = default_params(K)
sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means, sigmas=sigmas)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means, sigmas=sigmas)
sim = simulate_hmm(
rng, T, K; init_probs=init_probs, transition=transition, means=means, sigmas=sigmas
)

Comment on lines +89 to +95
T = T,
K = K,
y = sim.obs,
init_probs = init_probs,
transition = transition,
means = means,
sigmas = sigmas,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
T = T,
K = K,
y = sim.obs,
init_probs = init_probs,
transition = transition,
means = means,
sigmas = sigmas,
T=T,
K=K,
y=sim.obs,
init_probs=init_probs,
transition=transition,
means=means,
sigmas=sigmas,

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

gd2 = JModel.GraphEvaluationData{typeof(gd.node_function_vals),typeof(gd.loop_vars_vals)}(


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

inner = replace(s[3:end-1], " " => "")


[JuliaFormatter] reported by reviewdog 🐶

c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

i = try parse(Int, s[3:end-1]) catch; -1 end


[JuliaFormatter] reported by reviewdog 🐶

if gd.is_discrete_finite_vals[i] && !gd.is_observed_vals[i] && gd.is_stochastic_vals[i]


[JuliaFormatter] reported by reviewdog 🐶

for k in (i+1):length(disc_parents)


[JuliaFormatter] reported by reviewdog 🐶

for j in (i+1):length(neighbors_vec)


[JuliaFormatter] reported by reviewdog 🐶

for j in (i+1):length(neighbors_vec)


[JuliaFormatter] reported by reviewdog 🐶

test_model = make_model_with_order(model, build_eval_order_from_discrete_order(model, order))


[JuliaFormatter] reported by reviewdog 🐶

test_model = make_model_with_order(model, build_eval_order_from_discrete_order(model, order))


[JuliaFormatter] reported by reviewdog 🐶

@warn "Failed to precompute auto-marginalization caches; falling back to graph evaluation" exception=(err, catch_backtrace())


[JuliaFormatter] reported by reviewdog 🐶

branch_loglikelihoods = Vector{typeof(lik_val)}(undef, length(possible_values))


[JuliaFormatter] reported by reviewdog 🐶

log_joint_total = LogExpFunctions.logsumexp(total_logpriors .+ branch_loglikelihoods)


[JuliaFormatter] reported by reviewdog 🐶

data = (
K=2,
w=[0.3, 0.7],
delta=[0.0, 2.0],
sigma=1.0,
y=1.5,
)

@printf "# HMM correctness sweep\n"
@printf "# seed,K,T,logp_autmarg,logp_forward,diff\n"
for seed in seed_vals, K in Ks, T in Ts
logp, logp_ref = run_case(K=K, T=T, seed=seed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
logp, logp_ref = run_case(K=K, T=T, seed=seed)
logp, logp_ref = run_case(; K=K, T=T, seed=seed)

isempty(xs) ? [50] : xs
end

eps = try parse(Float64, get(ENV, "AGC_EPS", "1e-5")) catch; 1e-5 end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
eps = try parse(Float64, get(ENV, "AGC_EPS", "1e-5")) catch; 1e-5 end
eps = try
parse(Float64, get(ENV, "AGC_EPS", "1e-5"))
catch
; 1e-5
end

transition[k, k] = diag
end
means_true, sigmas_true = default_hmm_params(K)
sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means_true, sigmas=sigmas_true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means_true, sigmas=sigmas_true)
sim = simulate_hmm(
rng,
T,
K;
init_probs=init_probs,
transition=transition,
means=means_true,
sigmas=sigmas_true,
)

means_true, sigmas_true = default_hmm_params(K)
sim = simulate_hmm(rng, T, K; init_probs=init_probs, transition=transition, means=means_true, sigmas=sigmas_true)

mu_prior_mean, mu_prior_std, logsigma_prior_mean, logsigma_prior_std = priors_from_truth(means_true, sigmas_true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
mu_prior_mean, mu_prior_std, logsigma_prior_mean, logsigma_prior_std = priors_from_truth(means_true, sigmas_true)
mu_prior_mean, mu_prior_std, logsigma_prior_mean, logsigma_prior_std = priors_from_truth(
means_true, sigmas_true
)

Comment on lines +114 to +122
T = T,
K = K,
y = sim.y,
init_probs = init_probs,
transition = transition,
mu_prior_mean = mu_prior_mean,
mu_prior_std = mu_prior_std,
logsigma_prior_mean = logsigma_prior_mean,
logsigma_prior_std = logsigma_prior_std,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
T = T,
K = K,
y = sim.y,
init_probs = init_probs,
transition = transition,
mu_prior_mean = mu_prior_mean,
mu_prior_std = mu_prior_std,
logsigma_prior_mean = logsigma_prior_mean,
logsigma_prior_std = logsigma_prior_std,
T=T,
K=K,
y=sim.y,
init_probs=init_probs,
transition=transition,
mu_prior_mean=mu_prior_mean,
mu_prior_std=mu_prior_std,
logsigma_prior_mean=logsigma_prior_mean,
logsigma_prior_std=logsigma_prior_std,

Comment on lines +96 to +97
c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end
c = try
parse(Int, parts[1])
catch
; -1
end
t = try
parse(Int, parts[2])
catch
; -1
end

for (j, vn) in enumerate(gd.sorted_nodes)
s = string(vn)
if startswith(s, "z[")
inner = replace(s[3:end-1], " " => "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
inner = replace(s[3:end-1], " " => "")
inner = replace(s[3:(end - 1)], " " => "")

Comment on lines +137 to +138
c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
c = try parse(Int, parts[1]) catch; -1 end
t = try parse(Int, parts[2]) catch; -1 end
c = try
parse(Int, parts[1])
catch
; -1
end
t = try
parse(Int, parts[2])
catch
; -1
end


function place_with_dependencies(vn)
i = pos[vn]
if placed[i]; return; end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
if placed[i]; return; end
if placed[i]
;
return nothing;
end

obs_nodes = [i for i in 1:n if gd.is_stochastic_vals[i] && gd.is_observed_vals[i]]
obs_disc_parents = Dict{Int,Vector{Int}}()
for j in obs_nodes
ps = [p for p in st_parents[j] if gd.is_discrete_finite_vals[p] && !gd.is_observed_vals[p]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
ps = [p for p in st_parents[j] if gd.is_discrete_finite_vals[p] && !gd.is_observed_vals[p]]
ps = [
p for
p in st_parents[j] if gd.is_discrete_finite_vals[p] && !gd.is_observed_vals[p]
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants