Skip to content

About

The Pólya-Gamma augmented BinomialPolya and MultinomialPolya nodes for message passing (GPL-3)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

PolyaMessagePassingRules

CI Docs: stable Docs: dev Coverage Code style: Runic

This package is licensed under GPL-3, because its dependency PolyaGammaHybridSamplers is. The engine and the other rule packages are MIT and do not depend on it.

The Pólya-Gamma augmented nodes for count data through the logistic, whose messages towards the weights are normal:

  • BinomialPolya, y ~ Binomial(n, σ(xᵀβ)): binomial and logistic regression, under BinomialPolyaApproximation(; samples = nothing);
  • MultinomialPolya, x ~ Multinomial(N, p(ψ)) by logistic stick-breaking: multinomial regression, under MultinomialPolyaApproximation(; points = 21).

Both algorithms are the nodes' defaults. The rules towards the weights read the message on the weights' own edge, which a model must initialise.

using PolyaMessagePassingRules, MessagePassingRulesBase, BayesBase, ExponentialFamily

result = @call_message_update_rule(
    node = BinomialPolya, target = :β,
    q = (y = PointMass(3), x = PointMass([0.1, 0.2]), n = PointMass(5)),
    m = (β = MvNormalWeightedMeanPrecision(zeros(2), [1.0 0.0; 0.0 1.0]),),
)
getresult(result)   # MvNormalWeightedMeanPrecision, ξ = (3 - 5/2) x, Λ = (5/4) x xᵀ
import Pkg; Pkg.add("PolyaMessagePassingRules")
  • Documentation: https://reactivebayes.github.io/PolyaMessagePassingRules.jl/stable/. make docs builds it locally, into docs/build.
  • Tests: make test runs the suite as CI does, ending with the rule-coverage gate: every rule must be selected by some test. make test test_args="name:rules" selects items by tag, by name or by file; make help lists the other targets.
  • Julia 1.10 or later. Licence: GPL-3.

About

The Pólya-Gamma augmented BinomialPolya and MultinomialPolya nodes for message passing (GPL-3)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages