- class liesel.model.nodes.Var(value, distribution=None, name='')[source]#
A variable in a statistical model, typically with a probability distribution.
A variable in Liesel is typically a random variable, e.g. an observed or latent variable with a probability distribution, or a model parameter with a prior distribution. Note that observed variables and model parameters should typically be declared with the
Param()helper functions. Other quantities can also be declared as variables, e.g. fixed data like hyperparameters or design matrices, or quantities that are computed from other nodes, e.g. structured additive predictors in semi-parametric regression models.
Calcnode does not have an associated probability distribution, it is possible but not necessary to declare it as a variable. There is no hard and fast rule when a node without a probability distribution should be declared as a variable and when not. The advantages of a variable in this case are: (1) easier access via the
Model.varsattribute, and (2) more explicit visualization with the
plot_vars()function. This might be particularly desirable for the hyperparameters of a prior distribution.
Returns all input nodes as a unique tuple.
Returns all input variables as a unique tuple.
Returns all output nodes as a unique tuple.
Returns all output variables as a unique tuple.
Updates the variable.
Additional meta-information about the variable as a dict.
The distribution node of the variable.
The groups that this variable is a part of.
Whether the variable has a probability distribution.
The log-probability of the variable.
The model the variable is part of.
The name of the variable.
The nodes of the variable as a list.
Whether the variable is observed.
Whether the variable is a parameter.
The role of the variable.
Whether the variable is strong.
The value of the variable.
The value node of the variable.
The proxy node for the value of the variable.
Whether the variable is weak.