How to use the yarl.components.common.decay_components.exponential_decay.ExponentialDecay function in yarl

To help you get started, we’ve selected a few yarl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rlgraph / rlgraph / yarl / components / common / decay_components / __init__.py View on Github external
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from .decay_component import DecayComponent
from .exponential_decay import ExponentialDecay
from .polynomial_decay import PolynomialDecay, LinearDecay

DecayComponent.__lookup_classes__ = dict(
    linear=LinearDecay,
    exponential=ExponentialDecay,
    polynomial=PolynomialDecay
)

__all__ = ["DecayComponent", "ExponentialDecay", "PolynomialDecay", "LinearDecay"]
github rlgraph / rlgraph / yarl / components / common / decay_components / exponential_decay.py View on Github external
def __init__(self, half_life=None, num_half_lives=10, scope="exponential-decay", **kwargs):
        """
        Args:
            half_life (Optional[int]): The half life period in number of timesteps. Use `num_half_lives` for a relative
                measure against `num_timesteps`.
            num_half_lives (Optional[int]): The number of sub-periods into which `num_timesteps` will be divided, each
                division being the length of time in which we decay 50%. This is an alternative to `half_life`.

        Keyword Args:
            see DecayComponent
        """
        assert isinstance(half_life, int) or isinstance(num_half_lives, int)

        super(ExponentialDecay, self).__init__(scope=scope, **kwargs)

        self.half_life_timesteps = half_life if half_life is not None else self.num_timesteps / num_half_lives