Value#
- class liesel.model.Value(value, _name='')[source]#
Bases:
NodeA
Nodesubclass that holds constant values.Since the information represented by a value node does not change, it is always up-to-date. A common usecase for value nodes is to cache computed values.
By default, value nodes will appear in the node graph created by
viz.plot_nodes(), but they will not appear in the model graph created byviz.plot_vars().You can wrap a value node in a
Varto make it appear in the model graph.
- Parameters:
See also
CalcA node representing a general calculation/operation in JAX or Python.
DistA node representing a
tensorflow_probabilityDistribution.VarA variable in a statistical model, typically with a probability distribution.
paramA helper function to initialize a
Varas a model parameter.obsA helper function to initialize a
Varas an observed variable.
Examples
A simple constant node representing a constant value without a name:
>>> nameless_node = lsl.Value(1.0) >>> nameless_node Value(name="")
Adding this node to a model leads to an automatically generated name:
>>> model = lsl.Model([nameless_node]) >>> nameless_node Value(name="n0")
A constant node with a name:
>>> node = lsl.Value(1.0, _name="my_name") >>> node Value(name="my_name")
Methods
add_inputs(*inputs, **kwinputs)Adds non-keyword and keyword input nodes to the existing ones.
Returns all non-keyword and keyword input nodes as a unique tuple.
Returns all output nodes as a unique tuple.
Clears the state of the node.
Stops the recursion setting outdated flags.
set_inputs(*inputs, **kwinputs)Sets the non-keyword and keyword input nodes.
update()Does nothing.
Attributes
The groups that this node is a part of.
The non-keyword input nodes.
The keyword input nodes.
The model the node is part of.
The name of the node.
Whether the node needs a seed / PRNG key.
Whether the node is outdated.
The output nodes.
The state of the node.
The value of the node.
The variable the node is part of.
Whether the node should be monitored by an inference algorithm.