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_valuefloat

Initial value for the multiplier.

cooling_factorfloat

Factor used to divide (or cool down) the multiplier when the update() method is called.

cooling_rateint, optional

Control how often the multiplier will be cooled down. The multiplier will be cooled down every cooling_rate call of the update method.

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.

Attributes

cooling_factor

Factor used to cool down the multiplier.

cooling_rate

How often the multiplier will be cooled down.

counter

Counts calls of the update method.

imag

Real numbers have no imaginary component.

mutable

Mutable flag.

real

Real numbers are their real component.

value

Wrapped multiplier.

initial_value

Methods

conjugate()

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 update method.

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 counter will be set to zero.


CooledMultiplier.update(*args)#

Cool down the multiplier.

The multiplier gets cooled down every cooling_factor calls to this method.

Parameters:
*args

Any argument will be ignored. They are kept to guarantee compatibility with the update method interface.

Notes

Cool down the multiplier by dividing it by the cooling factor. The cooling process happens once every cooling_factor calls of this method.