Skip to content

Conversation

@Red-Portal
Copy link
Member

No description provided.

@Red-Portal Red-Portal merged commit 981bcc7 into main Aug 19, 2025
8 of 16 checks passed
@Red-Portal Red-Portal deleted the update_README_v0.5 branch August 19, 2025 22:59

```julia
using LogDensityProblems
import LogDensityProblems
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
import LogDensityProblems
using LogDensityProblems: LogDensityProblems

```

Since the support of `x` is constrained to be positive and VI is best done in the unconstrained Euclidean space, we need to use a *bijector* to transform `x` into unconstrained Euclidean space. We will use the [`Bijectors.jl`](https://github.com/TuringLang/Bijectors.jl) package for this purpose.
Since the support of `σ` is constrained to be positive and most VI algorithms assume an unconstrained Euclidean support, we need to use a *bijector* to transform `θ`.
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Since the support of `σ` is constrained to be positive and most VI algorithms assume an unconstrained Euclidean support, we need to use a *bijector* to transform `θ`.
Since the support of `σ` is constrained to be positive and most VI algorithms assume an unconstrained Euclidean support, we need to use a *bijector* to transform `θ`.


```julia
using Bijectors
import Bijectors
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
import Bijectors
using Bijectors: Bijectors

Comment on lines +85 to +86
import OpenML
import DataFrames
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
import OpenML
import DataFrames
using OpenML: OpenML
using DataFrames: DataFrames

X = Matrix{Float64}(data[:, 1:(end - 1)])
y = Vector{Bool}(data[:, end] .== "Mine")
```
Let's apply some basic pre-processing and add an intercept column:
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Let's apply some basic pre-processing and add an intercept column:
Let's apply some basic pre-processing and add an intercept column:

d = LogDensityProblems.dimension(model_ad)
q = MeanFieldGaussian(zeros(d), Diagonal(ones(d)))
```
The bijector can now be applied to `q` to match the support of the target problem.
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
The bijector can now be applied to `q` to match the support of the target problem.
The bijector can now be applied to `q` to match the support of the target problem.

q = MeanFieldGaussian(zeros(d), Diagonal(ones(d)))
```
The bijector can now be applied to `q` to match the support of the target problem.
```julia
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
```julia
```julia


# Run inference
```
We can now run VI:
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
We can now run VI:
We can now run VI:

# Run inference
```
We can now run VI:
```julia
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
```julia
```julia

Comment on lines 136 to 141
q_avg, info, _ = AdvancedVI.optimize(
alg,
max_iter,
model,
model_ad,
q_transformed;
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
q_avg, info, _ = AdvancedVI.optimize(
alg,
max_iter,
model,
model_ad,
q_transformed;
)
q_avg, info, _ = AdvancedVI.optimize(alg, max_iter, model_ad, q_transformed;)

@github-actions
Copy link
Contributor

AdvancedVI.jl documentation for PR #193 is available at:
https://TuringLang.github.io/AdvancedVI.jl/previews/PR193/

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark Results

Benchmark suite Current: 4711e40 Previous: 864f5e9 Ratio
normal/RepGradELBO + STL/meanfield/Zygote 3884113557 ns 3940463414.5 ns 0.99
normal/RepGradELBO + STL/meanfield/ReverseDiff 1087580354 ns 1080457534 ns 1.01
normal/RepGradELBO + STL/meanfield/Mooncake 1187372637 ns 1186415910 ns 1.00
normal/RepGradELBO + STL/fullrank/Zygote 3876169524.5 ns 3880348067.5 ns 1.00
normal/RepGradELBO + STL/fullrank/ReverseDiff 1586673546 ns 1578889137 ns 1.00
normal/RepGradELBO + STL/fullrank/Mooncake 1230627189 ns 1245752131 ns 0.99
normal/RepGradELBO/meanfield/Zygote 2729318274.5 ns 2745244233 ns 0.99
normal/RepGradELBO/meanfield/ReverseDiff 753836095 ns 779172740 ns 0.97
normal/RepGradELBO/meanfield/Mooncake 1053213407 ns 1065162127 ns 0.99
normal/RepGradELBO/fullrank/Zygote 2746187641.5 ns 2779479552 ns 0.99
normal/RepGradELBO/fullrank/ReverseDiff 938784644 ns 922764899.5 ns 1.02
normal/RepGradELBO/fullrank/Mooncake 1101792362 ns 1099112093 ns 1.00
normal + bijector/RepGradELBO + STL/meanfield/Zygote 5608935852 ns 5520186124 ns 1.02
normal + bijector/RepGradELBO + STL/meanfield/ReverseDiff 2347525187 ns 2315766289 ns 1.01
normal + bijector/RepGradELBO + STL/meanfield/Mooncake 4004306569 ns 3960343348 ns 1.01
normal + bijector/RepGradELBO + STL/fullrank/Zygote 5631136713 ns 5464591378 ns 1.03
normal + bijector/RepGradELBO + STL/fullrank/ReverseDiff 2965503150.5 ns 2899203076.5 ns 1.02
normal + bijector/RepGradELBO + STL/fullrank/Mooncake 4171209341.5 ns 4077037587 ns 1.02
normal + bijector/RepGradELBO/meanfield/Zygote 4287497307.5 ns 4259257598 ns 1.01
normal + bijector/RepGradELBO/meanfield/ReverseDiff 2016252830 ns 1969823950 ns 1.02
normal + bijector/RepGradELBO/meanfield/Mooncake 3859733151.5 ns 3921065959 ns 0.98
normal + bijector/RepGradELBO/fullrank/Zygote 4364530532 ns 4347716606 ns 1.00
normal + bijector/RepGradELBO/fullrank/ReverseDiff 2290625728 ns 2217527377 ns 1.03
normal + bijector/RepGradELBO/fullrank/Mooncake 4015809201.5 ns 3950691343.5 ns 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants