val#
- gpjax.parameters.val(x)[source]#
Return a parameter’s constrained value.
Call this wherever a parameter meets arithmetic. Models are always held in their wrapped form – including the model
fitreturns – sovalis the single point at which the constraining bijection is applied.Safe to apply to anything: a parameter is resolved to its constrained value (recursively, so nested wrappers such as
paramax.non_trainableare handled), while a plain array or float is returned unchanged.- Parameters:
x – A parameter, or any value that does not need unwrapping.
- Returns:
The constrained value of
xif it is a parameter, elsexitself.
Example
>>> import jax.numpy as jnp >>> from gpjax.parameters import PositiveReal, val >>> float(val(PositiveReal(jnp.array(2.0)))) 2.0 >>> float(val(jnp.array(2.0))) 2.0