How to use the yarl.components.common.decay_components.polynomial_decay.PolynomialDecay 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
# 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 / polynomial_decay.py View on Github external
def __init__(self, power=1.0, scope="polynomial-decay", **kwargs):
        """
        Args:
            power (float): The polynomial power to use (e.g. 1.0 for linear).

        Keyword Args:
            see DecayComponent
        """
        super(PolynomialDecay, self).__init__(scope=scope, **kwargs)

        self.power = power
github rlgraph / rlgraph / yarl / components / common / decay_components / polynomial_decay.py View on Github external
Keyword Args:
            see DecayComponent
        """
        super(PolynomialDecay, self).__init__(scope=scope, **kwargs)

        self.power = power

    def decay(self, time_steps_in_decay_window):
        if backend == "tf":
            import tensorflow as tf
            return tf.train.polynomial_decay(self.from_, time_steps_in_decay_window, self.num_timesteps,
                                             self.to_, power=self.power)


# Create an alias for LinearDecay
LinearDecay = partial(PolynomialDecay, power=1.0)