inversion_ideas.base.Multiplier#
- class inversion_ideas.base.Multiplier(value, *, mutable=False)#
Multiplier hyperparameter.
Wraps a single float that can be used as a multiplier for objective functions.
- Parameters:
Attributes
Real numbers have no imaginary component.
Mutable flag.
Real numbers are their real component.
Wrapped multiplier.
Methods
Conjugate is a no-op for Reals.
Examples
A wrapped multiplier behaves like any regular float:
>>> beta = Multiplier(5.0) >>> print(beta) Multiplier(5.0)
>>> 3 * beta 15.0
By default the multiplier is immutable, i.e. we cannot change the value thorugh public methods.
>>> beta *= 5 Traceback (most recent call last): TypeError: ...
>>> beta.value = 10.0 Traceback (most recent call last): TypeError: ...
We can make it mutable when defining the multiplier:
>>> beta = Multiplier(5.0, mutable=True) >>> beta *= 5 >>> print(beta) Multiplier(25.0)
Attributes#
- Multiplier.imag#
Real numbers have no imaginary component.
- Multiplier.mutable#
Mutable flag.
- Multiplier.real#
Real numbers are their real component.
- Multiplier.value#
Wrapped multiplier.
Methods#
Methods documentation
- Multiplier.conjugate()#
Conjugate is a no-op for Reals.