inversion_ideas.hyperparams.CooledMultiplier#
- class inversion_ideas.hyperparams.CooledMultiplier(initial_value, *, cooling_factor, cooling_rate=1, mutable=False)#
Multiplier hyperparameter that can be cooled down.
Wraps a float into an object that can be cooled down through the
update()method.- Parameters:
- initial_value
float Initial value for the multiplier.
- cooling_factor
float Factor used to divide (or cool down) the multiplier when the
update()method is called.- cooling_rate
int, optional Control how often the multiplier will be cooled down. The multiplier will be cooled down every
cooling_ratecall of theupdatemethod.- mutablebool, optional
If False, the wrapped value is immutable, i.e. we cannot change it through public properties and methods besides the
update()method. If True, the wrapped value is mutable and can be freely modified.
- initial_value
Attributes
Factor used to cool down the multiplier.
How often the multiplier will be cooled down.
Counts calls of the
updatemethod.Real numbers have no imaginary component.
Mutable flag.
Real numbers are their real component.
Wrapped multiplier.
initial_value
Methods
Conjugate is a no-op for Reals.
reset()Reset the multiplier to the initial values.
update(*args)Cool down the multiplier.
Examples
>>> beta = CooledMultiplier(10.0, cooling_factor=2.0) >>> print(beta) CooledMultiplier(10.0)
>>> beta.value 10.0
>>> beta.update() >>> print(beta) CooledMultiplier(5.0)
>>> beta.value 5.0
Attributes#
- CooledMultiplier.cooling_factor#
Factor used to cool down the multiplier.
- CooledMultiplier.cooling_rate#
How often the multiplier will be cooled down.
- CooledMultiplier.counter#
Counts calls of the
updatemethod.
- CooledMultiplier.imag#
Real numbers have no imaginary component.
- CooledMultiplier.initial_value#
- CooledMultiplier.mutable#
Mutable flag.
- CooledMultiplier.real#
Real numbers are their real component.
- CooledMultiplier.value#
Wrapped multiplier.
Methods#
Methods documentation
- CooledMultiplier.conjugate()#
Conjugate is a no-op for Reals.
- CooledMultiplier.reset()#
Reset the multiplier to the initial values.
The value of the multiplier will be reset to its intial one, and the
counterwill be set to zero.
- CooledMultiplier.update(*args)#
Cool down the multiplier.
The multiplier gets cooled down every
cooling_factorcalls to this method.- Parameters:
- *args
Any argument will be ignored. They are kept to guarantee compatibility with the
updatemethod interface.
Notes
Cool down the multiplier by dividing it by the cooling factor. The cooling process happens once every
cooling_factorcalls of this method.