Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c16b38d
remove bold in formulas
mpieropan Apr 2, 2019
b4436b8
fix log in docs
mpieropan Apr 2, 2019
1b8e052
Merge pull request #1 from mpieropan/docsfix
mpieropan Apr 2, 2019
9b409bc
displaying my own documentation
mpieropan Apr 4, 2019
6c498a3
Merge branch 'master' of https://github.com/mpieropan/GaussianEP
mpieropan Apr 4, 2019
b401859
restored github.com/abraunst/GaussianEP.git in deploydocs repo
mpieropan Apr 12, 2019
54d60b8
Merge pull request #2 from mpieropan/test
mpieropan Apr 12, 2019
c06023c
Make EPOut mutable
mpieropan Apr 17, 2019
8540691
Merge pull request #3 from mpieropan/MutableEPOut
mpieropan Apr 17, 2019
5846e11
added Gaussian and Bernoulli RBM units
mpieropan Aug 17, 2020
d2e382f
Added posdef assertion for matrix A
mpieropan Sep 25, 2020
faf1c66
changed callback call in expectation_propagation
mpieropan Oct 9, 2020
44b906f
added ThetaMixturePrior
Nov 20, 2020
1d68ab9
set master branch to current version of upstream repo
mpieropan Nov 21, 2020
4fdc18d
resolved conflict
Nov 21, 2020
54e9c7a
Added theta mixture prior
mpieropan Mar 16, 2021
442bf56
Merge remote-tracking branch 'upstream/master'
mpieropan Mar 16, 2021
246c6a1
displaying my own documentation
mpieropan Apr 4, 2019
a963adc
restored github.com/abraunst/GaussianEP.git in deploydocs repo
mpieropan Apr 12, 2019
2a5e45f
added Gaussian and Bernoulli RBM units
mpieropan Aug 17, 2020
d0a699c
Added posdef assertion for matrix A
mpieropan Sep 25, 2020
20d54ee
added ThetaMixturePrior
Nov 20, 2020
abd8199
set master branch to current version of upstream repo
mpieropan Nov 21, 2020
d52a535
Added theta mixture prior
mpieropan Mar 16, 2021
4576f78
Merge branch 'master' of https://github.com/mpieropan/GaussianEP
mpieropan Mar 16, 2021
6918f79
same src as upstream
mpieropan Mar 16, 2021
2d75cdd
Merge branch 'upstream' of https://github.com/mpieropan/GaussianEP in…
mpieropan Mar 16, 2021
189b228
just one line
mpieropan Mar 16, 2021
c3cd572
Added theta mixture prior to priors.jl
mpieropan Mar 16, 2021
98b16be
changed params of callback function in expectation_propagation
mpieropan Mar 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/.DS_Store
Binary file not shown.
Empty file modified src/GaussianEP.jl
100644 → 100755
Empty file.
Empty file modified src/ProgressReporter.jl
100644 → 100755
Empty file.
Empty file modified src/Term.jl
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/expectation_propagation.jl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function expectation_propagation(H::AbstractVector{Term{T}}, P0::AbstractVector{
for i in 1:length(H)
updateβ(H[i], av[1:Nx])
end
ret = callback(av,Δav,epsconv,maxiter,H,P0)
ret = callback(iter,state,Δav,Δva,epsconv,maxiter,H,P0)
if ret === true || (Δav < epsconv && norm(F*av[1:Nx]+d-av[Nx+1:end]) < 1e-4)
return EPOut(state, :converged)
end
Expand Down
31 changes: 31 additions & 0 deletions src/priors.jl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,34 @@ function moments(::ThetaPrior,μ,σ)
return av,var
end

"""
A mixture of theta priors: p_0(x)=η*Θ(x)+(1-η)*Θ(-x)
"""
mutable struct ThetaMixturePrior{T<:Real} <: Prior
η::T
δη::T
end

function theta_mixt_factor(x,η)
f=exp(-0.5*x^2.0)/(η*erfc(-sqrt(0.5)*x)+(1.0-η)*erfc(sqrt(0.5)*x))
return f
end

function moments(p0::ThetaMixturePrior,μ,σ)
η=p0.η
α=μ/σ
f=theta_mixt_factor(α,η)
χ=sqrt(2.0/π)*(2.0*η-1.0)*f
av=μ+σ*χ
va=σ^2.0*(1-χ^2.0)-μ*σ*χ
return av,va
end

function gradient(p0::ThetaMixturePrior,μ,σ)
η=p0.η
x=μ/σ/sqrt(2)
num=2*erf(x)
den=η*erfc(-x)+(1-η)*erfc(x)
p0.η+=p0.δη*num/den
p0.η=clamp(p0.η,0,1)
end