DistRegBuilder.transform()
DistRegBuilder.transform()#
- DistRegBuilder.transform(var, bijector=None, *args, **kwargs)#
Transforms a variable by adding a new transformed variable as an input.
Creates a new variable on the unconstrained space
R**n
with the appropriate transformed distribution, turning the original variable into a weak variable without an associated distribution. The transformation is performed using TFP’s bijector classes.The value of the attribute
parameter
is transferred to the transformed variable and set toFalse
on the original variable. The attributesobserved
androle
are set to the default values for the transformed variable and remain unchanged on the original variable.- Parameters
var (
Var
) – The variable to transform (and add to the graph).bijector (
Optional
[type
[Union
[Bijector
,Bijector
]]]) – The bijector used to map the new transformed variable to this variable (forward transformation). IfNone
, the experimental default event space bijector (see TFP documentation) is used. (default:None
)args – The arguments passed on to the init function of the bijector.
kwargs – The keyword arguments passed on to the init function of the bijector.
- Return type
- Returns
The new transformed variable which acts as an input to this variable.
- Raises
RuntimeError – If the variable is weak, has no TFP distribution, the distribution has no default event space bijector and the argument
bijector
isNone
, or the local model for the variable cannot be built.