Skip to content

Commit

Permalink
Merge branch 'hotfix/fix-examples-for-python'
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeyeongYang committed Sep 1, 2019
2 parents 4fb5abd + 9ab20cd commit 8281d79
Show file tree
Hide file tree
Showing 48 changed files with 1,104 additions and 960 deletions.
43 changes: 23 additions & 20 deletions Python/hbayesdm/models/_bandit2arm_delta.py
Expand Up @@ -93,6 +93,22 @@ def bandit2arm_delta(
mentioned above are present and labeled correctly, there is no need to
remove other miscellaneous data columns.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Parameters
----------
data
Expand Down Expand Up @@ -163,22 +179,6 @@ def bandit2arm_delta(
**additional_args
Not used for this model.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Returns
-------
model_data
Expand All @@ -198,18 +198,21 @@ def bandit2arm_delta(
.. code:: python
from hbayesdm import rhat, print_fit
from hbayesdm.models import bandit2arm_delta
# Run the model and store results in "output"
output <- bandit2arm_delta(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
output = bandit2arm_delta(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
# Visually check convergence of the sampling chains (should look like "hairy caterpillars")
output.plot(type='trace')
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Plot posterior distributions of the hyper-parameters (distributions should be unimodal)
output.plot()
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Show the LOOIC and WAIC model fit estimates
print_fit(output)
"""
Expand Down
43 changes: 23 additions & 20 deletions Python/hbayesdm/models/_bandit4arm2_kalman_filter.py
Expand Up @@ -100,6 +100,22 @@ def bandit4arm2_kalman_filter(
mentioned above are present and labeled correctly, there is no need to
remove other miscellaneous data columns.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Parameters
----------
data
Expand Down Expand Up @@ -170,22 +186,6 @@ def bandit4arm2_kalman_filter(
**additional_args
Not used for this model.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Returns
-------
model_data
Expand All @@ -205,18 +205,21 @@ def bandit4arm2_kalman_filter(
.. code:: python
from hbayesdm import rhat, print_fit
from hbayesdm.models import bandit4arm2_kalman_filter
# Run the model and store results in "output"
output <- bandit4arm2_kalman_filter(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
output = bandit4arm2_kalman_filter(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
# Visually check convergence of the sampling chains (should look like "hairy caterpillars")
output.plot(type='trace')
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Plot posterior distributions of the hyper-parameters (distributions should be unimodal)
output.plot()
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Show the LOOIC and WAIC model fit estimates
print_fit(output)
"""
Expand Down
43 changes: 23 additions & 20 deletions Python/hbayesdm/models/_bandit4arm_2par_lapse.py
Expand Up @@ -96,6 +96,22 @@ def bandit4arm_2par_lapse(
mentioned above are present and labeled correctly, there is no need to
remove other miscellaneous data columns.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Parameters
----------
data
Expand Down Expand Up @@ -166,22 +182,6 @@ def bandit4arm_2par_lapse(
**additional_args
Not used for this model.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Returns
-------
model_data
Expand All @@ -201,18 +201,21 @@ def bandit4arm_2par_lapse(
.. code:: python
from hbayesdm import rhat, print_fit
from hbayesdm.models import bandit4arm_2par_lapse
# Run the model and store results in "output"
output <- bandit4arm_2par_lapse(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
output = bandit4arm_2par_lapse(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
# Visually check convergence of the sampling chains (should look like "hairy caterpillars")
output.plot(type='trace')
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Plot posterior distributions of the hyper-parameters (distributions should be unimodal)
output.plot()
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Show the LOOIC and WAIC model fit estimates
print_fit(output)
"""
Expand Down
43 changes: 23 additions & 20 deletions Python/hbayesdm/models/_bandit4arm_4par.py
Expand Up @@ -98,6 +98,22 @@ def bandit4arm_4par(
mentioned above are present and labeled correctly, there is no need to
remove other miscellaneous data columns.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Parameters
----------
data
Expand Down Expand Up @@ -168,22 +184,6 @@ def bandit4arm_4par(
**additional_args
Not used for this model.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Returns
-------
model_data
Expand All @@ -203,18 +203,21 @@ def bandit4arm_4par(
.. code:: python
from hbayesdm import rhat, print_fit
from hbayesdm.models import bandit4arm_4par
# Run the model and store results in "output"
output <- bandit4arm_4par(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
output = bandit4arm_4par(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
# Visually check convergence of the sampling chains (should look like "hairy caterpillars")
output.plot(type='trace')
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Plot posterior distributions of the hyper-parameters (distributions should be unimodal)
output.plot()
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Show the LOOIC and WAIC model fit estimates
print_fit(output)
"""
Expand Down
43 changes: 23 additions & 20 deletions Python/hbayesdm/models/_bandit4arm_lapse.py
Expand Up @@ -100,6 +100,22 @@ def bandit4arm_lapse(
mentioned above are present and labeled correctly, there is no need to
remove other miscellaneous data columns.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Parameters
----------
data
Expand Down Expand Up @@ -170,22 +186,6 @@ def bandit4arm_lapse(
**additional_args
Not used for this model.
.. note::
``adapt_delta``, ``stepsize``, and ``max_treedepth`` are advanced options that
give the user more control over Stan's MCMC sampler. It is recommended that
only advanced users change the default values, as alterations can profoundly
change the sampler's behavior. See [Hoffman2014]_ for more information on the
sampler control parameters. One can also refer to 'Section 34.2. HMC Algorithm
Parameters' of the `Stan User's Guide and Reference Manual`__.
.. [Hoffman2014]
Hoffman, M. D., & Gelman, A. (2014).
The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.
Journal of Machine Learning Research, 15(1), 1593-1623.
__ http://mc-stan.org/users/documentation/
Returns
-------
model_data
Expand All @@ -205,18 +205,21 @@ def bandit4arm_lapse(
.. code:: python
from hbayesdm import rhat, print_fit
from hbayesdm.models import bandit4arm_lapse
# Run the model and store results in "output"
output <- bandit4arm_lapse(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
output = bandit4arm_lapse(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
# Visually check convergence of the sampling chains (should look like "hairy caterpillars")
output.plot(type='trace')
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Plot posterior distributions of the hyper-parameters (distributions should be unimodal)
output.plot()
# Check Rhat values (all Rhat values should be less than or equal to 1.1)
rhat(output, less=1.1)
# Show the LOOIC and WAIC model fit estimates
print_fit(output)
"""
Expand Down

0 comments on commit 8281d79

Please sign in to comment.