Spaces:
Running
on
Zero
Running
on
Zero
File size: 508 Bytes
e6ac593 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import numpy as np
from ripe import utils
log = utils.get_pylogger(__name__)
class ExpDecay:
"""Exponential decay scheduler.
args:
a: float, a + c = initial value
b: decay rate
c: float, final value
f(x) = a * e^(-b * x) + c
"""
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
log.info(f"ExpDecay: a={a}, b={b}, c={c}")
def __call__(self, step):
return self.a * np.exp(-self.b * step) + self.c
|