Graph¶
The graph module provides the core data structures for defining probabilistic models.
Overview¶
A Falcon graph consists of Node objects connected by parent-child relationships.
The Graph class manages these relationships and handles topological sorting for
correct execution order.
Classes¶
Node
¶
Node(name, simulator_cls, estimator_cls=None, parents=None, evidence=None, scaffolds=None, observed=False, resample=False, simulator_config=None, estimator_config=None, actor_config=None, num_actors=1)
Node definition for a graphical model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the node. |
required |
create_distr
|
class
|
Distribution class to create the node. |
required |
config
|
dict
|
Configuration for the distribution. |
required |
parents
|
list
|
List of parent node names (forward model). |
None
|
evidence
|
list
|
List of evidence node names (inference model). |
None
|
observed
|
bool
|
Whether the node is observed (act as root nodes for inference model). |
False
|
actor_name
|
str
|
Optional name of the actor to deploy the node. |
required |
resample
|
bool
|
Whether to resample the node |
False
|
Source code in falcon/core/graph.py
Graph
¶
Source code in falcon/core/graph.py
Functions¶
CompositeNode
¶
Auxiliary function to create a composite node with multiple child nodes.
Source code in falcon/core/graph.py
create_graph_from_config
¶
Create a computational graph from YAML configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph_config
|
Dictionary containing graph node definitions |
required | |
_cfg
|
Full Hydra configuration object (optional) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Graph |
The computational graph |
Raises:
| Type | Description |
|---|---|
ValueError
|
If configuration is invalid (missing required fields, unknown references) |
Source code in falcon/core/graph.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |