lnccbrown / HSSM

Development of HSSM package
Other
71 stars 10 forks source link

Feature request for graphical model representation and documentation improvement for priors #400

Closed gingjehli closed 1 month ago

gingjehli commented 2 months ago

I've been working on visualizing a complex model using the HSSM toolbox that incorporates both between-subject and within-subject effects, along with their interactions. Unfortunately, I encountered difficulties in displaying the graphical representation within a Jupyter Notebook due to its large size. It would be highly beneficial to have a straightforward option either to resize the graph for quick reviews or to store it externally. Currently, when attempting to use pymc or graphviz directly for this purpose, I encounter an error stating that the "HSSM" object has no attribute "named_vars". Here is the code snippet I used:

graph = pm.model_to_graphviz(model_test) graph

Addtionally, while reviewing the graphical model, I noticed that the tutorials focus on specifying priors for the main coefficients but omit details on the standard deviations of these coefficients. Including this information in the tutorials, perhaps with a dedicated section on defining, understanding, and applying these standard deviations, would greatly enhance user comprehension and application accuracy.

digicosmos86 commented 2 months ago

Thanks @gingjehli! It is possible to specify the size of the graph. First, you need to call model.graph() method after you have constructed the model to get the graph. There is a figsize argument that you can provide to specify the width and height of the graph. For other options, you can refer to the bambi tutorial for more available options. We don't recommend pm.model_to_graphviz() since there are other processing that we have included in model.graph().

We will add more detailed tutorials for specifying hierarchical models. Please stay tuned :).

Thanks! Paul