Giter Club home page Giter Club logo

bmad's Introduction

Bayesian models for Astrophysical data

Resources for Bayesian Models for Astrophysical Data - using R, JAGS, Python and Stan - by Hilbe, de Souza and Ishida, 2017, Cambridge University Press

Winner of 2018 PROSE Awards in the category Cosmology and Astronomy

Complete book website: www.BayesianModelsForAstrophysicalData.com

The book can be purchased at Cambridge University Press


Table of Contents

bmad's People

Contributors

astrobayes avatar emilleishida avatar rafaelsdesouza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bmad's Issues

Code 2.3 will not run

In Code 2.3 the line:
results = smf.ols(formula = 'y ~ x1 + x2', data = mydata).fit()

generates this error:
`AttributeError Traceback (most recent call last)
in
----> 1 results = smf.ols(formula = 'y ~ x1 + x2', data = mydata).fit()

AttributeError: module 'statsmodels.api' has no attribute 'ols'`

The fix is to change the line to:
results = smf.OLS.from_formula(formula = 'y ~ x1 + x2', data = mydata).fit()

Example 8.21 may have some typos

PyMC3 example of NB regression in Code_8.21.py gives the following error message.

File "code_8.21.py", line 50, in
y = pm.NegativeBinomial('y', mu=pm.exp(eta), alpha=alpha, observed=y)
AttributeError: module 'pymc3' has no attribute 'exp'

I think that the pm.exp(eta) should be replaced with np.exp(eta).
I get the same result with Python2.7 and Python3.5.
I am using PyMC3 version 3.1.

After making the above change, the script runs for a much longer time and then throuws an error on line 54

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
from pandas.core import datetools
Optimization terminated successfully.
Current function value: 3854.710331
Iterations: 31
Function evaluations: 48
Gradient evaluations: 48
Traceback (most recent call last):
File "./code_8.21.py", line 54, in
step = pm.NUTS(state=start) # Initiate sampling
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/nuts.py", line 149, in init
super(NUTS, self).init(vars, use_single_leapfrog=True, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/base_hmc.py", line 64, in init
vars, shared, model.logpt, self.potential, use_single_leapfrog, integrator, **theano_kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/trajectory.py", line 124, in get_theano_hamiltonian_functions
energy_function, p = _theano_energy_function(H, q, **theano_kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/trajectory.py", line 54, in _theano_energy_function
energy_function = theano.function(inputs=[q, p], outputs=total_energy, **theano_kwargs)
TypeError: function() got an unexpected keyword argument 'state'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.