lnccbrown / HSSM

Development of HSSM package
Other
82 stars 11 forks source link

TypeError: ModelGraph._make_node() missing 1 required keyword-only argument: 'node_formatters' #474

Closed YuanboBQ closed 5 months ago

YuanboBQ commented 5 months ago

After updated to v0.2.2, when I .graph() founction, the following occur. Is there a bug, or I miss something. I have installed graphviz (11.0.0).

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], [line 1](vscode-notebook-cell:?execution_count=7&line=1)
----> [1](vscode-notebook-cell:?execution_count=7&line=1) model_hierarchical.graph()

File ~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:932, in HSSM.graph(self, formatting, name, figsize, dpi, fmt)
    [892](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:892) """Produce a graphviz Digraph from a built HSSM model.
    [893](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:893) 
    [894](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:894) Requires graphviz, which may be installed most easily with `conda install -c
   (...)
    [926](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:926)     Credit for the code goes to Bambi developers.
    [927](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:927) """
    [928](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:928) self.model._check_built()
    [930](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:930) graphviz = HSSMModelGraph(
    [931](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:931)     model=self.pymc_model, parent=self._parent_param
--> [932](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:932) ).make_graph(formatting=formatting, response_str=self.response_str)
    [934](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:934) width, height = (None, None) if figsize is None else figsize
    [936](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/hssm.py:936) if name is not None:

File ~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:221, in HSSMModelGraph.make_graph(self, var_names, formatting, response_str)
    [219](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:219)     else:
    [220](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:220)         for var_name in all_var_names:
--> [221](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:221)             self._make_node(var_name, graph, formatting=formatting)
    [223](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:223) if self.parent.is_regression:
    [224](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:224)     # Insert the parent parameter that's not included in the graph
    [225](https://file+.vscode-resource.vscode-cdn.net/Users/yuanbo/Work%20and%20Study/Python_projects/HSSM/~/miniforge3/envs/HSSM/lib/python3.11/site-packages/hssm/utils.py:225)     with graph.subgraph(name="cluster" + self.parent.name) as sub:

TypeError: ModelGraph._make_node() missing 1 required keyword-only argument: 'node_formatters'
AlexanderFengler commented 5 months ago

@digicosmos86 could this be something about PyMC versioning? Did they change some format?

digicosmos86 commented 5 months ago

Yeah we've heard feedback on PyMC 5.15 breaking graphing functionalities. This will no longer be an issue once Bambi updates. For now, please fix PyMC version to 5.14, which should resolve this issue.

AlexanderFengler commented 5 months ago

@YuanboBQ closing this for now, it's going to be automatically taken care of in refactor after the next bambi release