LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lsst.scarlet.lite.parameters.AdaproxParameter Class Reference
Inheritance diagram for lsst.scarlet.lite.parameters.AdaproxParameter:
lsst.scarlet.lite.parameters.Parameter

Public Member Functions

 __init__ (self, np.ndarray x, Callable|float step, Callable|None grad=None, Callable|None prox=None, float b1=0.9, float b2=0.999, float eps=1e-8, float p=0.25, np.ndarray|None m0=None, np.ndarray|None v0=None, np.ndarray|None vhat0=None, str scheme="amsgrad", float prox_e_rel=1e-6)
 
 update (self, int it, np.ndarray input_grad, *args)
 

Public Attributes

 b1
 
 b2
 
 eps
 
 p
 
 phi_psi
 
 e_rel
 
 x
 

Detailed Description

Operator updated using te Proximal ADAM algorithm

Uses multiple variants of adaptive quasi-Newton gradient descent
    * Adam (Kingma & Ba 2015)
    * NAdam (Dozat 2016)
    * AMSGrad (Reddi, Kale & Kumar 2018)
    * PAdam (Chen & Gu 2018)
    * AdamX (Phuong & Phong 2019)
    * RAdam (Liu et al. 2019)
See details of the algorithms in the respective papers.

Definition at line 356 of file parameters.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.scarlet.lite.parameters.AdaproxParameter.__init__ ( self,
np.ndarray x,
Callable | float step,
Callable | None grad = None,
Callable | None prox = None,
float b1 = 0.9,
float b2 = 0.999,
float eps = 1e-8,
float p = 0.25,
np.ndarray | None m0 = None,
np.ndarray | None v0 = None,
np.ndarray | None vhat0 = None,
str scheme = "amsgrad",
float prox_e_rel = 1e-6 )

Reimplemented from lsst.scarlet.lite.parameters.Parameter.

Definition at line 369 of file parameters.py.

384 ):
385 shape = x.shape
386 dtype = x.dtype
387 if m0 is None:
388 m0 = np.zeros(shape, dtype=dtype)
389
390 if v0 is None:
391 v0 = np.zeros(shape, dtype=dtype)
392
393 if vhat0 is None:
394 vhat0 = np.ones(shape, dtype=dtype) * -np.inf
395
396 super().__init__(
397 x,
398 {
399 "m": m0,
400 "v": v0,
401 "vhat": vhat0,
402 },
403 step,
404 grad,
405 prox,
406 )
407
408 if isinstance(b1, float):
409 _b1 = SingleItemArray(b1)
410 else:
411 _b1 = b1
412
413 self.b1 = _b1
414 self.b2 = b2
415 self.eps = eps
416 self.p = p
417
418 self.phi_psi = phi_psi[scheme]
419 self.e_rel = prox_e_rel
420

Member Function Documentation

◆ update()

lsst.scarlet.lite.parameters.AdaproxParameter.update ( self,
int it,
np.ndarray input_grad,
* args )
Update the parameter and meta-parameters using the PGM

See `~Parameter` for more.

Reimplemented from lsst.scarlet.lite.parameters.Parameter.

Definition at line 421 of file parameters.py.

421 def update(self, it: int, input_grad: np.ndarray, *args):
422 """Update the parameter and meta-parameters using the PGM
423
424 See `~Parameter` for more.
425 """
426 _x = self.x
427 # Calculate the gradient
428 grad = cast(Callable, self.grad)(input_grad, _x, *args)
429 # Get the update for the parameter
430 phi, psi = self.phi_psi(
431 it,
432 grad,
433 self.helpers["m"],
434 self.helpers["v"],
435 self.helpers["vhat"],
436 self.b1,
437 self.b2,
438 self.eps,
439 self.p,
440 )
441 # Calculate the step size
442 step = self.step
443 if it > 0:
444 _x += -step * phi / psi
445 else:
446 # This is a scheme that Peter Melchior and I came up with to
447 # dampen the known affect of ADAM, where the first iteration
448 # is often much larger than desired.
449 _x += -step * phi / psi / 10
450
451 self.x = cast(Callable, self.prox)(_x)
452
453

Member Data Documentation

◆ b1

lsst.scarlet.lite.parameters.AdaproxParameter.b1

Definition at line 413 of file parameters.py.

◆ b2

lsst.scarlet.lite.parameters.AdaproxParameter.b2

Definition at line 414 of file parameters.py.

◆ e_rel

lsst.scarlet.lite.parameters.AdaproxParameter.e_rel

Definition at line 419 of file parameters.py.

◆ eps

lsst.scarlet.lite.parameters.AdaproxParameter.eps

Definition at line 415 of file parameters.py.

◆ p

lsst.scarlet.lite.parameters.AdaproxParameter.p

Definition at line 416 of file parameters.py.

◆ phi_psi

lsst.scarlet.lite.parameters.AdaproxParameter.phi_psi

Definition at line 418 of file parameters.py.

◆ x

lsst.scarlet.lite.parameters.AdaproxParameter.x

Definition at line 451 of file parameters.py.


The documentation for this class was generated from the following file: