Documented scheduler module
This commit is contained in:
		
							parent
							
								
									ea62ccf389
								
							
						
					
					
						commit
						720bb1b051
					
				
					 3 changed files with 50 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,6 @@
 | 
			
		|||
Hyperparameter Scheduling
 | 
			
		||||
=========================
 | 
			
		||||
.. automodule:: rltorch.scheduler
 | 
			
		||||
.. autoclass:: rltorch.scheduler.LinearScheduler
 | 
			
		||||
   :members:
 | 
			
		||||
.. autoclass:: rltorch.scheduler.ExponentialScheduler
 | 
			
		||||
   :members:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,30 @@
 | 
			
		|||
from .Scheduler import Scheduler
 | 
			
		||||
class ExponentialScheduler(Scheduler):
 | 
			
		||||
    r"""
 | 
			
		||||
    A exponential scheduler that given a certain number
 | 
			
		||||
    of iterations, spaces the values between
 | 
			
		||||
    a start and an end point in an exponential order.
 | 
			
		||||
 | 
			
		||||
    Notes
 | 
			
		||||
    -----
 | 
			
		||||
    The forumula used to produce the value :math:`y` is based on the number of
 | 
			
		||||
    times you call `next`. (denoted as :math:`i`)
 | 
			
		||||
 | 
			
		||||
    :math:`y(1) = initial\_value`
 | 
			
		||||
    :math:`y(i) = y(1) \cdot base^{i - 1}`
 | 
			
		||||
    :math:`base = \sqrt[iterations]{\frac{end\_value}{initial\_value}}`.
 | 
			
		||||
 | 
			
		||||
    Another property is that :math:`y(iterations) = end\_value`.
 | 
			
		||||
 | 
			
		||||
    Parameters
 | 
			
		||||
    ----------
 | 
			
		||||
    initial_value : number
 | 
			
		||||
      The first value returned in the schedule.
 | 
			
		||||
    end_value: number
 | 
			
		||||
      The value returned when the maximum number of iterations are reached
 | 
			
		||||
    iterations: int
 | 
			
		||||
      The total number of iterations
 | 
			
		||||
    """
 | 
			
		||||
    def __init__(self, initial_value, end_value, iterations):
 | 
			
		||||
        super(ExponentialScheduler, self).__init__(initial_value, end_value, iterations)
 | 
			
		||||
        self.base = (end_value / initial_value) ** (1.0 / iterations)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,27 @@
 | 
			
		|||
from .Scheduler import Scheduler
 | 
			
		||||
class LinearScheduler(Scheduler):
 | 
			
		||||
    r"""
 | 
			
		||||
    A linear scheduler that given a certain number
 | 
			
		||||
    of iterations, equally spaces the values between
 | 
			
		||||
    a start and an end point.
 | 
			
		||||
 | 
			
		||||
    Notes
 | 
			
		||||
    -----
 | 
			
		||||
    The forumula used to produce the value :math:`y` is based on the number of
 | 
			
		||||
    times you call `next`. (denoted as :math:`i`)
 | 
			
		||||
 | 
			
		||||
    :math:`y(i) = slope \cdot (i - 1) + initial\_value`
 | 
			
		||||
    where :math:`slope = \frac{end\_value - initial\_value)}{iterations}`.
 | 
			
		||||
 | 
			
		||||
    Parameters
 | 
			
		||||
    ----------
 | 
			
		||||
    initial_value : number
 | 
			
		||||
      The first value returned in the schedule.
 | 
			
		||||
    end_value: number
 | 
			
		||||
      The value returned when the maximum number of iterations are reached
 | 
			
		||||
    iterations: int
 | 
			
		||||
      The total number of iterations
 | 
			
		||||
    """
 | 
			
		||||
    def __init__(self, initial_value, end_value, iterations):
 | 
			
		||||
        super(LinearScheduler, self).__init__(initial_value, end_value, iterations)
 | 
			
		||||
        self.slope = (end_value - initial_value) / iterations
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue