Skip to content

Commit

Permalink
created leaky prox (possible remedy for #222)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmelchior committed Jan 28, 2021
1 parent 262a13a commit 5bdbbb8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scarlet/blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging

from .component import CombinedComponent
from .constraint import Constraint
from .model import UpdateException

logger = logging.getLogger("scarlet.blend")
Expand Down Expand Up @@ -130,12 +131,20 @@ def expand_grads(*X, func=None):
l + p for l, p in zip(grad_logL(*X), grad_logP(*X))
)

# step sizes, allow for random skipping of parameters
# step sizes
_step = lambda *X, it: tuple(
x.step(x, it=it) if hasattr(x.step, "__call__") else x.step
for x in X
)
_prox = tuple(x.constraint for x in X)

# proxes, allow for random skipping
_prox = tuple(
lambda Z, step, parameter=x: 0.95 * parameter.constraint(Z, step)
+ 0.05 * Z
if parameter.constraint is not None
else Z
for x in X
)

# good defaults for adaprox
scheme = alg_kwargs.pop("scheme", "amsgrad")
Expand Down

0 comments on commit 5bdbbb8

Please sign in to comment.