Skip to content

Commit

Permalink
rename optimization rules file, add docstrings to averagers
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Portal committed Aug 10, 2024
1 parent 38d97ff commit 466bbf9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/AdvancedVI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ include("families/location_scale.jl")

# Optimization Update Rules

include("optimization/optimizers.jl")
include("optimization/optrules.jl")

export DoWG, DoG, COCOB

Expand Down
23 changes: 23 additions & 0 deletions src/optimization/averaging.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

"""
NoAveraging()
No averaging. This returns the last-iterate of the optimization rule.
"""
struct NoAveraging <: AbstractAverager end

init(::NoAveraging, x) = x
Expand All @@ -7,6 +12,24 @@ apply(::NoAveraging, state, x) = x

value(::NoAveraging, state) = state

"""
PolynomialAveraging(eta)
Polynomial averaging rule proposed [Shamir and Zhang](https://proceedings.mlr.press/v28/shamir13.html)
At iteration `t`, the polynomial averaging rule is given as
```julia
params_avg = (1 - w) * params_avg + w * x
```
where the averaging weight is
```julia
w = (eta + 1) / (t + eta)
```
Higher `eta` down-weights earlier iterations.
The [DoG paper](https://arxiv.org/abs/2302.12022) suggests `eta = 8`.
# Parameters
- eta: Regularization term. (default: `8`)
"""
struct PolynomialAveraging{F} <: AbstractAverager
eta::F
end
Expand Down
86 changes: 0 additions & 86 deletions src/optimization/optimizers.jl

This file was deleted.

0 comments on commit 466bbf9

Please sign in to comment.