-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #386 from ReactiveBayes/reimplement-node-macro
Reimplement node macro
- Loading branch information
Showing
9 changed files
with
148 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
import SpecialFunctions: logbeta | ||
|
||
@node Beta Stochastic [out, α, β] | ||
@node Beta Stochastic [out, (a, aliases = [α]), (b, aliases = [β])] | ||
|
||
@average_energy Beta (q_out::Any, q_α::Any, q_β::Any) = logbeta(mean(q_α), mean(q_β)) - (mean(q_α) - 1.0) * mean(log, q_out) - (mean(q_β) - 1.0) * mean(mirrorlog, q_out) | ||
@average_energy Beta (q_out::Any, q_a::Any, q_b::Any) = logbeta(mean(q_a), mean(q_b)) - (mean(q_a) - 1.0) * mean(log, q_out) - (mean(q_b) - 1.0) * mean(mirrorlog, q_out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
@marginalrule Beta(:out_α_β) (m_out::Beta, m_α::PointMass, m_β::PointMass) = begin | ||
return convert_paramfloattype((out = prod(ClosedProd(), Beta(mean(m_α), mean(m_β)), m_out), a = m_α, b = m_β)) | ||
@marginalrule Beta(:out_a_b) (m_out::Beta, m_a::PointMass, m_b::PointMass) = begin | ||
return convert_paramfloattype((out = prod(ClosedProd(), Beta(mean(m_a), mean(m_b)), m_out), a = m_a, b = m_b)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
@rule Beta(:out, Marginalisation) (m_α::PointMass, m_β::PointMass) = Beta(mean(m_α), mean(m_β)) | ||
@rule Beta(:out, Marginalisation) (m_a::PointMass, m_b::PointMass) = Beta(mean(m_a), mean(m_b)) | ||
|
||
@rule Beta(:out, Marginalisation) (q_α::PointMass, q_β::PointMass) = Beta(mean(q_α), mean(q_β)) | ||
@rule Beta(:out, Marginalisation) (q_a::PointMass, q_b::PointMass) = Beta(mean(q_a), mean(q_b)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.