Skip to content

Commit

Permalink
style: make format
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Jan 30, 2025
1 parent 24f1454 commit 630acaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/rules/binomial_polya/y.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using ExponentialFamily.LogExpFunctions
else
n_samples = getn_samples(meta)
βsamples = rand(meta.rng, q_β, n_samples)
p_avg = mapreduce(βsample -> logistic(dot(x, βsample)), +, eachcol(βsamples))/n_samples
p_avg = mapreduce(βsample -> logistic(dot(x, βsample)), +, eachcol(βsamples)) / n_samples
return Binomial(n, p_avg)
end
end
end
6 changes: 2 additions & 4 deletions test/rules/binomial_polya/y_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
q_x = PointMass([0.1, 0.2])
q_n = PointMass(5)
q_β = MvNormalWeightedMeanPrecision([3.0, -1.0], diageye(2))

# Test with default meta
pred_dist = @call_rule BinomialPolya(:y, Marginalisation) (q_x = q_x, q_n = q_n, q_β = q_β, meta = nothing)
@test pred_dist isa Binomial
@test ntrials(pred_dist) == 5

# Test with Monte Carlo sampling
meta = BinomialPolyaMeta(1000, MersenneTwister(42))
pred_dist_mc = @call_rule BinomialPolya(:y, Marginalisation) (q_x = q_x, q_n = q_n, q_β = q_β, meta = meta)
Expand All @@ -23,6 +23,4 @@

@test pred_dist_mc.p pred_dist.p atol = 1e-2
end

end

2 comments on commit 630acaf

@bvdmitri
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/124021

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.6.1 -m "<description of version>" 630acafbb8a0dce46b58dad740413df32e930284
git push origin v4.6.1

Please # to comment.