-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Describe the issue:
The function update_node_formatters in pymc/model_graph.py validates the keys of node_formatters against the NodeType enum members. However, the public examples in model_to_graphviz and model_to_networkx show users passing string keys such as "Free Random Variable" and "Observed Random Variable".
Since these keys are strings (matching NodeType.value) and not actual NodeType enum members, the current validation raises a ValueError, even though the usage follows the documented examples.
This results in a mismatch between the documented API and the actual behavior.
Reproduceable code example:
### Reproducible Example
import pymc as pm
with pm.Model() as model:
x = pm.Normal("x", 0, 1)
# Using documented string keys for node_formatters
node_formatters = {
"Free Random Variable": lambda var: {"shape": "circle", "label": var.name},
}
# This raises a ValueError in update_node_formatters
pm.model_to_graphviz(model, node_formatters=node_formatters)Error message:
PyMC version information:
- PyMC Version: 5.27
- Python Version: 3.12
- Operating System: Windows 11
Context for the issue:
No response
Reactions are currently unavailable