Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into improve_examples
  • Loading branch information
theogf committed Jul 19, 2022
2 parents 0b6daef + 8130b94 commit 532d59d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/CompatHelper.yml
Expand Up @@ -2,18 +2,27 @@ name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'
- cron: 0 0 * * *
workflow_dispatch:

jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.3
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
- uses: actions/checkout@v2
- name: "Install CompatHelper"
run: |
import Pkg
name = "CompatHelper"
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
version = "3"
Pkg.add(; name, uuid, version)
shell: julia --color=yes {0}
- name: "Run CompatHelper"
run: |
import CompatHelper
CompatHelper.main(; bump_version=true)
shell: julia --color=yes {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
8 changes: 4 additions & 4 deletions src/inference/analyticVI.jl
Expand Up @@ -266,9 +266,9 @@ end
state.local_vars,
)
tot -= GaussianKL(model, state)
tot -= Zygote.@ignore(
tot -= ChainRulesCore.ignore_derivatives() do
ρ(inference(model)) * AugmentedKL(likelihood(model), state.local_vars, y)
)
end
tot -= extraKL(model, state)
return tot
end
Expand All @@ -290,9 +290,9 @@ end
state.local_vars,
)
tot -= GaussianKL(model, state)
tot -= Zygote.@ignore(
tot -= ChainRulesCore.ignore_derivatives() do
sum(ρ(inference(model)) * AugmentedKL.(likelihood(model), state.local_vars, y))
)
end
return tot
end

Expand Down
2 changes: 1 addition & 1 deletion src/likelihood/bayesiansvm.jl
Expand Up @@ -80,7 +80,7 @@ function expec_loglikelihood(
end

function AugmentedKL(l::BernoulliLikelihood{<:SVMLink}, state, ::Any)
Zygote.@ignore(GIGEntropy(l, state))
ChainRulesCore.@ignore_derivatives GIGEntropy(l, state)
end

function GIGEntropy(::BernoulliLikelihood{<:SVMLink}, state)
Expand Down
2 changes: 1 addition & 1 deletion src/likelihood/laplace.jl
Expand Up @@ -99,7 +99,7 @@ function expec_loglikelihood(
state,
)
tot = -length(y) * log(twoπ) / 2
tot += Zygote.@ignore(sum(log, state.θ)) / 2
tot += ChainRulesCore.@ignore_derivatives sum(log, state.θ) / 2
tot +=
-(
dot(state.θ, diag_cov) + dot(state.θ, abs2.(μ)) - 2.0 * dot(state.θ, μ .* y) +
Expand Down
2 changes: 1 addition & 1 deletion src/likelihood/negativebinomial.jl
Expand Up @@ -122,7 +122,7 @@ function expec_loglikelihood(
diag_cov::AbstractVector,
state,
)
tot = Zygote.@ignore(sum(negbin_logconst(y, l.r))) - log(2.0) * sum(y .+ l.r)
tot = ChainRulesCore.@ignore_derivatives(sum(negbin_logconst(y, l.r))) - log(2.0) * sum(y .+ l.r)
tot += dot(μ, (y .- l.r)) / 2 - dot(state.θ, μ) / 2 - dot(state.θ, diag_cov) / 2
return tot
end
Expand Down
4 changes: 2 additions & 2 deletions src/likelihood/poisson.jl
Expand Up @@ -114,9 +114,9 @@ function expec_loglikelihood(
state,
)
tot = (dot(μ, (y - state.γ)) - dot(state.θ, abs2.(μ)) - dot(state.θ, Σ)) / 2
tot += Zygote.@ignore(
tot += ChainRulesCore.ignore_derivatives() do
sum(y * log(l.invlink.λ[1])) - sum(logfactorial, y) - logtwo * sum((y + state.γ))
)
end
return tot
end

Expand Down
7 changes: 7 additions & 0 deletions test/Project.toml
Expand Up @@ -7,3 +7,10 @@ PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
Distances = "0.10"
Distributions = "0.25"
MLDataUtils = "0.5"
PDMats = "0.11"
Zygote = "0.6"

0 comments on commit 532d59d

Please sign in to comment.