Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

doc: Update README, add Sphinx docs, add Jupyter notebook #9

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

treszkai
Copy link

@treszkai treszkai commented Sep 6, 2019

Add Sphinx docs, which is now online at best.readthedocs.io.

Add a Jupyter notebook for the smart_drug.py example.

(This is part 4 of 4 pull requests that build on top of one another.)

(Using 2to3 tool)
(There was a Warning that I should increase it.)
Gives _identical_ results as the original hdi_of_mcmc()
xmin, xmax was unassigned if `bins is None`.
The current version works whether bins is None, an integer, or a list/array.
… subscript)

Without subscript it's less cluttered.
With only 100 points it looked way too segmented on a wide figure.
It shows up nicely on the output of pm.summary(trace).

And display nu on the log scale, instead of displaying
 log(nu) on a linear scale.
Upgrade to Python 3, PyMC3, Matplotlib 3.0.0, restructure module a bit.

PyMC3 required dropping Python 2 support.
+ add `best.summary()` as an alias for `pymc3.summary()`
+ remove unused variables in `make_model()`

Planned functions for the next release of best:
 - `best.analyze_one` (for analysis of a single group)
 - `best.power` (for power analysis)
(This was the case for me on macOS.)
That would be required in high-dimensional spaces, where
applying KDE is impossible.
========================

Make plot_data_and_prediction() suitable for API use

- Use group_data and best_out parameters instead of
data, means, stds, numos.
- Add kwargs arguments for the hist and the posterior predictions.
- Create new Axes if None was supplied.
- Return created Axes.

========================

Improve aesthetics of plot_data_and_prediction()

Biggest change: change to rwidth=1.0.

Reason:
The previous version (of rwidth=0.5) was *great* for integer data, but counter-intuitive for continuous data.

========================

refactor: Use plt.subplots() instead of fig.add_subplot() in plot_all()

And share the x axis between the μ graphs and between the σ graphs.

========================

refactor: Simplify mode calculation, add hpd(); Move summary() to best.utils; remove calc_ prefixes
This way, plotting results is easier (there is no need to pass the data again to the plotting functions),
 and there is an OOP structure where objects lend themselves to certain actions.

========================

Change draw_zero:bool to ref_val:Optional[float] in best.plot.
This matches the ArviZ API (apart from the possibility of None).

========================

Change variable_name to var_name in best.plot.
This matches the ArviZ API closer (apart from the possibility of a list).
Sigma of t-distribution is not the std. dev.

Instead, variance = nu / (nu - 2) * sigma ** 2 if nu > 2, and
 variance = infty if 1 < nu <= 2.

Having even one sample of infinite std. dev. makes them incomparable,
 therefore in Model v2 we have:
 nu ~ Exp(1/27.5) + 2.5, and
 SD = sigma * (nu / (nu - 2)) ** 0.5

As a consequence, reduced the displayed limits of the std.devs in
plot_posterior and plot_all to 99.5% of the samples.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant