- class liesel.model.model.GraphBuilder[source]#
A graph builder to prepare a
Constructs a model containing all nodes and variables that were added to the graph builder and their recursive inputs. The outputs of the nodes are not added to the model automatically, so the root nodes always need to be added explicitly.
The standard workflow is to create the nodes and variables, add them to a graph builder, and construct a model from the graph builder. After the model has been constructed, some methods of the graph builder are not available anymore.
>>> a = lsl.Var(1.0, name="a") >>> b = lsl.Var(2.0, name="b") >>> c = lsl.Var(lsl.Calc(lambda x, y: x + y, a, b), name="c") >>> gb = lsl.GraphBuilder() >>> gb.add(c) GraphBuilder<0 nodes, 1 vars> >>> model = gb.build_model() >>> model Model<9 nodes, 3 vars> >>> c.value 3.0 >>> gb.vars 
Adds nodes, variables or other graph builders to the graph.
Adds groups to the graph.
Builds a model from the graph.
Returns a shallow copy of the graph builder.
Counts the number of times each node name occurs in the graph.
Counts the number of times each variable name occurs in the graph.
Collects the groups from all nodes and variables.
Plots all nodes in the graph.
Plots all variables in the graph.
Renames all nodes and variables in the graph.
Renames all nodes in the graph.
Renames all variables in the graph.
Transforms a variable by adding a new transformed variable as an input.
Updates all nodes in the graph.
The user-defined log-likelihood node.
The user-defined log-prior node.
The user-defined log-probability node.
The nodes that were explicitly added to the graph.
The variables that were explicitly added to the graph.