# Typical workflow in PyMC3

**URL:** <https://discourse.pymc.io/t/typical-workflow-in-pymc3/713>\
**Category:** Questions\
**Created:** [January 9, 2018, 1:52pm UTC](https://discourse.pymc.io/t/typical-workflow-in-pymc3/713 "2018-01-09T13:52:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgenem](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jorgenem/32/429_2.png) [@jorgenem](https://discourse.pymc.io/u/jorgenem)\
**Post date:** [January 9, 2018, 1:52pm UTC](https://discourse.pymc.io/t/typical-workflow-in-pymc3/713/1 "2018-01-09T13:52:25Z")

</div>

Hi,

I’m still new to PyMC3, and hoping for some advice. I am doing a Bayesian fit using NUTS, to a model that is very heavy (i.e. time consuming to evaluate, both likelihood and gradient). I run it on computing nodes where I only have terminal access. Sometimes, especially while I’m testing the model, I need to be able to cancel it before it has completed the set number of steps. Therefore I’ve been running with the text backend option, so that it saves each step as a row in a text file, which I can then copy to my computer and load. But this seems to disable the energyplot() function, as the text backend does not store energy information (unless I’m missing something).

In browsing other questions here, I came across the pm.trace\_to\_dataframe(trace) function, which looks like another option for saving the trace to file. But that would only be run after the sampler is done, I suppose, and thus require the run to be carried to the end.

What are your typical workflows in PyMC3? Do you usually run on your own computer, maybe in an interactive session like iPython? Do you use backends, and if so which? How do you make sure to get all relevant information out of your run?

Thanks!

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [January 9, 2018, 2:15pm UTC](https://discourse.pymc.io/t/typical-workflow-in-pymc3/713/2 "2018-01-09T14:15:08Z")

</div>

Hi @jorgenem,

I usually work on my own computer with jupyter notebook. I dont use backend personally, but you can try the hdf5 backend (see mention here [Using text backend raises sampler stats error](https://discourse.pymc.io/t/using-text-backend-raises-sampler-stats-error/165/8?u=junpenglao)).

If you are using NUTS, the [pystan workflow](http://mc-stan.org/users/documentation/case-studies/pystan_workflow.html) is a good place to start (we also recommend similar checks). In general, I usually start with small model and simulation data with known parameters, and adding more complexity. Relevant information in terms of model fitting and model comparisons are documented within a notebook. For example, @AustinRochford’s recent [blog post](http://austinrochford.com/posts/2017-12-29-quantifying-reading.html) is an excellent example of a typical pymc3 workflow.

---

<div class="post-metadata">

**Author:** ![jorgenem](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jorgenem/32/429_2.png) [@jorgenem](https://discourse.pymc.io/u/jorgenem)\
**Post date:** [January 9, 2018, 4:42pm UTC](https://discourse.pymc.io/t/typical-workflow-in-pymc3/713/3 "2018-01-09T16:42:58Z")

</div>

Thanks so much @junpenglao! This is super useful info.
