AmpersandTV / pymc3-hmm

Hidden Markov models in PyMC3
Other
94 stars 13 forks source link

Add histogram plot for posterior predictives #66

Closed fanshi118 closed 3 years ago

fanshi118 commented 3 years ago

Thank your for opening a PR!

Here are a few important guidelines and requirements to check before your PR can be merged:

Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

brandonwillard commented 3 years ago

We can ignore the coverage requirements for that new plotting function (i.e. set # pragma: no cover on the function).

fanshi118 commented 3 years ago

We can ignore the coverage requirements for that new plotting function (i.e. set # pragma: no cover on the function).

Just made the update: got rid of the wrapper and rearranged the commits.

fanshi118 commented 3 years ago

@brandonwillard - just rebased. Moved the wrapper/styling code from utils.py to the notebook, returning axes in plot_predictive_histograms.

fanshi118 commented 3 years ago

I don't think we need to add the demo notebook when we merge this. It would be good to make it available independently as a Gist, though.

Removed; Gist added here.

fanshi118 commented 3 years ago

Can you make the same plotting and out-of-sample updates to the other example notebook? That example should produce a much more interesting out-of-sample plot; one for which this new plotting function should really shine.

The time-varying model has time-dependent variables, which require the shape parameters to be reset as we sample the out-of-sample posterior predictives. This likely will lead to using the design matrix, for us to be able to update the time-dependent variables as we'd like to in OOS. I updated the notebook so that it drops the S_t and P_t, assumes the same shape, and truncates the series to the first week, just to show how the histogram plot would look. @brandonwillard , let me know what you think of this as opposed to potentially using the design matrix for this example.

brandonwillard commented 3 years ago

Have you considered using pcolorfast instead of fill_between? I'm not sure if it would make for a good alternative, but it seems like it.

fanshi118 commented 3 years ago

Have you considered using pcolorfast instead of fill_between? I'm not sure if it would make for a good alternative, but it seems like it.

Not yet. Seems interesting though. Will give it a shot and let you know.