Skip to content

Commit

Permalink
CI: fix token to trigger docs at release
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Aug 8, 2022
1 parent c3d9717 commit 1f91a3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

include:
- os: macos-latest
version: '1.5'
version: '1.7'
arch: x64

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.TAGBOT_PAT }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
16 changes: 11 additions & 5 deletions src/bregman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mutable struct BregmanParams
spg
TD
λfunc
reset_λ
end

"""
Expand All @@ -33,17 +34,19 @@ Options structure for the bregman iteration algorithm
- `λ`: a pre-set threshold, will only be used if `λfunc` is not defined, default is nothing
- `quantile`: a percentage to calculate the threshold by quantile of the dual variable in 1st iteration, will only be used if neither `λfunc` nor `λ` are defined, default is .95 i.e thresholds 95% of the vector
- `w`: a weight vector that is applied on the threshold element-wise according to relaxation of weighted l1, default is 1 (no weighting)
- `reset_lambda`: How often should lambda be updated. Defaults to `nothing` i.e lambda is nerver updated and estimated at the first iteration.
"""
function bregman_options(;verbose=1, progTol=1e-8, maxIter=20, store_trace=false, antichatter=true, alpha=.5, spg=false, TD=LinearAlgebra.I, quantile=.95, λ=nothing, λfunc=nothing, w=1)
function bregman_options(;verbose=1, progTol=1e-8, maxIter=20, store_trace=false, antichatter=true, alpha=.5,
spg=false, TD=LinearAlgebra.I, quantile=.95, λ=nothing, λfunc=nothing, w=1,
reset_lambda=nothing)
if isnothing(λfunc)
if ~isnothing(λ)
λfunc = z->λ
else
λfunc = z->Statistics.quantile(abs.(z), quantile)
end
end
return BregmanParams(verbose, progTol, maxIter, store_trace, antichatter, alpha, spg, TD, z->w.*λfunc(z))
return BregmanParams(verbose, progTol, maxIter, store_trace, antichatter, alpha, spg, TD, z->w.*λfunc(z), reset_lambda)
end

"""
Expand Down Expand Up @@ -154,7 +157,7 @@ function bregman(funobj::Function, x::AbstractVector{T}, options::BregmanParams=
# Update z variable
@. z = z + d
# Get λ at first iteration
(i == 1) && (sol.λ = abs.(T.(options.λfunc(z))))
set_λ!(sol, z, options, i, options.reset_λ)
# Save curent state
options.spg && (gold .= g; xold .= x)
# Update x
Expand Down Expand Up @@ -210,4 +213,7 @@ function breglog(init_x, init_z; lambda0=0, f0=0, obj0=0)
end

noop_callback(::BregmanIterations) = nothing
scale!(d, t) = (t == 0 || !isLegal(t)) ? lmul!(1/norm(d)^2, d) : lmul!(abs(t), d)
scale!(d, t) = (t == 0 || !isLegal(t)) ? lmul!(1/norm(d)^2, d) : lmul!(abs(t), d)

set_λ!(sol::BregmanIterations, z::AbstractVector{T}, options::BregmanParams, s, ::Nothing) where {T} = (s == 1) ? set_λ!(sol, z, options, s, 1) : nothing
set_λ!(sol::BregmanIterations, z::AbstractVector{T}, options::BregmanParams, s::Integer, rs::Integer) where {T} = (s % rs == 0 || s == 1) ? (sol.λ = abs.(T.(options.λfunc(z)))) : nothing

0 comments on commit 1f91a3a

Please sign in to comment.