Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Sushmit Roy
    Here is the result what I get. Is there a reason . As per explanation in the book the mean for b in above should be close to -0.13 which we also find during fitting of the multivariate model of m5_3. But in my results I seem to be get a different answer.
    Any idea when chapter 9 and 10 of rethinking2 coming out ?
    Sushmit Roy
    The plot for 5.33 is significantly different from what the book has. Any idea why is the case ? The KDE should have a value centered around 2.1. Howver in the solution it is centered around 0.7
    Alexandre ANDORRA
    Hi @sushmit86,
    Regarding your first question, I don't think the difference between -0.13 (the mean you get from the book) and -0.20 (the mean you get from running your model) is worrisome when you consider how wide the HPD is for b: from -0.95 to 0.5. Basically, it seems that the model is quite uncertain about the true value of b, probably because there aren't a lot of data and the priors are quite wide (Normal(0, 10) for the parameters and Uniform for the std). Have you tried with more informative priors, as in the second edition for instance?
    Regarding your second question, I'm afraid I can't really help, as I mainly worked on porting the second edition :grimacing:
    Alexandre ANDORRA
    @saurabh2086 chapter 9 is almost ready but the person doing the PR (pymc-devs/resources#91) has been quite busy and didn't finish it yet. If you're willing, we can merge it and you can then open a PR implementing the changes @aloctavodia suggested in the currently opened PR?
    Chapter 10 is stale and no PR is open, so you can claim it and open a PR if you want? :)
    Sushmit Roy
    @AlexAndorra Thanks for the responses
    @AlexAndorra Thanks for the response. Thanks to all the people who are involved in converting those examples in python. is there any development in the pipeline for chapters 15 and 16?
    Alexandre ANDORRA

    Thanks @saurabh2086 !

    is there any development in the pipeline for chapters 15 and 16?

    Not really: I wanted to do it but really don't have the time currently :cry: Do you feel like doing it and open a PR?

    Mikhail Baranov
    Hi, it seems that in 5.15 we should sample posterior from m_5_3, not from m_5_4. Also number 5.47 is dropped and it affects all further numbering
    Alexandre ANDORRA
    Hi @uasek , thanks for flaggin this! Do you want to make a PR to fix this for everyone?
    Mikhail Baranov
    @AlexAndorra, I am new to github, how does that work?
    Alexandre ANDORRA
    I don't have a "definitive" guide in mind, but these two look very useful: https://www.dataschool.io/how-to-contribute-on-github/ and https://opensource.guide/how-to-contribute/
    As you'll see, nothing very intimidating here, and feel free to ask questions ;) Looking forward to seeing your first PR!
    Mikhail Baranov
    @AlexAndorra I did it, thanks :)
    Alexandre ANDORRA
    Just reviewed and it looks good, thanks a lot :)

    I get the same dead Kernel issue as @mikeviotti . But I'm simply in the Jupyter notebook and executing
    import pymc3 as pm

    print("Running on PyMC3 v{}".format(pm.version))

    Here's the listing of the environment:

    packages in environment at C:\Users\RWilsker\Anaconda\envs\fortheano:


    Name Version Build Channel

    argon2-cffi 20.1.0 py38h1e8a9f7_2 conda-forge
    arviz 0.10.0 py_0 conda-forge
    async_generator 1.10 py_0 conda-forge
    attrs 20.2.0 pyh9f0ad1d_0 conda-forge
    backcall 0.2.0 pyh9f0ad1d_0 conda-forge
    backports 1.0 py_2 conda-forge
    backports.functools_lru_cache 1.6.1 py_0 conda-forge
    blas 1.0 mkl
    bleach 3.2.1 pyh9f0ad1d_0 conda-forge
    bzip2 1.0.8 he774522_3 conda-forge
    ca-certificates 2020.6.20 hecda079_0 conda-forge
    certifi 2020.6.20 py38h9bdc248_2 conda-forge
    cffi 1.14.3 py38h0e640b1_1 conda-forge
    cftime 1.2.1 py38h1e00858_1 conda-forge
    colorama 0.4.4 pyh9f0ad1d_0 conda-forge
    curl 7.71.1 h4b64cdc_8 conda-forge
    cycler 0.10.0 py_2 conda-forge
    decorator 4.4.2 py_0 conda-forge
    defusedxml 0.6.0 py_0 conda-forge
    entrypoints 0.3 py38h32f6830_1002 conda-forge
    fastprogress 1.0.0 py_0 conda-forge
    freetype 2.10.4 hd328e21_0 conda-forge
    h5py 2.10.0 nompi_py38h6053941_105 conda-forge
    hdf4 4.2.13 hf8e6fe8_1003 conda-forge
    hdf5 1.10.6 nompi_h89124ea_1110 conda-forge
    icc_rt 2019.0.0 h0cc432a_1
    importlib-metadata 2.0.0 py_1 conda-forge
    importlib_metadata 2.0.0 1 conda-forge
    intel-openmp 2019.4 245
    ipykernel 5.3.4 py38h7b7c402_1 conda-forge
    ipython 7.18.1 py38h1cdfbd6_1 conda-forge
    ipython_genutils 0.2.0 py_1 conda-forge
    jedi 0.17.2 py38h32f6830_1 conda-forge
    jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
    jpeg 9d he774522_0 conda-forge
    jsonschema 3.2.0 py_2 conda-forge
    jupyter_client 6.1.7 py_0 conda-forge
    jupyter_core 4.6.3 py38h32f6830_2 conda-forge
    jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
    kiwisolver 1.2.0 py38h95a2b95_1 conda-forge
    krb5 1.17.1 hc04afaa_3 conda-forge
    libblas 3.8.0 14_mkl conda-forge
    libcblas 3.8.0 14_mkl conda-forge
    libcurl 7.71.1 h4b64cdc_8 conda-forge
    libgpuarray 0.7.6 hfa6e2cd_1003 conda-forge
    liblapack 3.8.0 14_mkl conda-forge
    libnetcdf 4.7.4 nompi_h256d12c_105 conda-forge
    libpng 1.6.37 ha81a0f5_2 conda-forge
    libsodium 1.0.18 h62dcd97_1 conda-forge
    libssh2 1.9.0 hb06d900_5 conda-forge
    libtiff 4.1.0 h885aae3_6 conda-forge
    lz4-c 1.9.2 h62dcd97_2 conda-forge
    m2w64-gcc-libgfortran 5.3.0 6
    m2w64-gcc-libs 5.3.0 7
    m2w64-gcc-libs-core 5.3.0 7

    m2w64-gmp 6.1.0 2
    m2w64-libwinpthread-git 2
    mako 1.1.3 pyh9f0ad1d_0 conda-forge
    markupsafe 1.1.1 py38hab1e662_2 conda-forge
    matplotlib-base 3.3.2 py38h6584adb_1 conda-forge
    mistune 0.8.4 py38h1e8a9f7_1002 conda-forge
    mkl 2019.4 245
    mkl-service 2.3.0 py38hfa6e2cd_0 conda-forge
    msys2-conda-epoch 20160418 1
    nbclient 0.5.1 py_0 conda-forge
    nbconvert 6.0.7 py38h32f6830_1 conda-forge
    nbformat 5.0.8 py_0 conda-forge
    nest-asyncio 1.4.1 py_0 conda-forge
    netcdf4 1.5.4 nompi_py38h87f19a6_103 conda-forge
    notebook 6.1.4 py38h32f6830_1 conda-forge
    numpy 1.19.2 py38hdf1ac2f_1 conda-forge
    olefile 0.46 pyh9f0ad1d_1 conda-forge
    openssl 1.1.1h he774522_0 conda-forge
    packaging 20.4 pyh9f0ad1d_0 conda-forge
    pandas 1.1.3 py38h3ef910b_2 conda-forge
    pandoc hf4a77e7_0 conda-forge
    pandocfilters 1.4.2 py_1 conda-forge
    parso 0.7.1 pyh9f0ad1d_0 conda-forge
    patsy 0.5.1 py_0 conda-forge
    pickleshare 0.7.5 py_1003 conda-forge
    pillow 8.0.0 py38h1d4d63c_0 conda-forge
    pip 20.2.4 py_0 conda-forge
    prometheus_client 0.8.0 pyh9f0ad1d_0 conda-forge
    prompt-toolkit 3.0.8 py_0 conda-forge
    pycparser 2.20 pyh9f0ad1d_2 conda-forge
    pygments 2.7.1 py_0 conda-forge
    pygpu 0.7.6 py38h1e00858_1002 conda-forge
    pymc3 3.9.3 py_1 conda-forge
    pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
    pyreadline 2.1 py38h32f6830_1002 conda-forge
    pyrsistent 0.17.3 py38h1e8a9f7_1 conda-forge
    python 3.8.6 h60c2a47_0_cpython conda-forge
    python-dateutil 2.8.1 py_0 conda-forge
    python_abi 3.8 1_cp38 conda-forge
    pytz 2020.1 pyh9f0ad1d_0 conda-forge
    pywin32 228 py38h1e8a9f7_0 conda-forge
    pywinpty 0.5.7 py38h32f6830_1 conda-forge
    pyzmq 19.0.2 py38h77b9d75_2 conda-forge
    scipy 1.5.0 py38h9439919_0
    send2trash 1.5.0 py_0 conda-forge
    setuptools 49.6.0 py38h9bdc248_2 conda-forge
    six 1.15.0 pyh9f0ad1d_0 conda-forge
    sqlite 3.33.0 he774522_1 conda-forge
    terminado 0.9.1 py38h32f6830_1 conda-forge
    testpath 0.4.4 py_0 conda-forge
    theano 1.0.5 py38h7ae7562_0 conda-forge
    tk 8.6.10 he774522_1 conda-forge
    tornado 6.0.4 py38h1e8a9f7_2 conda-forge
    tqdm 4.50.2 pyh9f0ad1d_0 conda-forge
    traitlets 5.0.5 py_0 conda-forge
    typing-extensions 0 conda-forge
    typing_extensions py_0 conda-forge
    vc 14.1 h869be7e_1 conda-forge
    vs2015_runtime 14.16.27012 h30e32a0_2 conda-forge
    vs2017_win-64 19.16.27038 h2e3bad8_2 conda-forge
    vswhere 2.7.1 h21ff451_0
    wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
    webencodings 0.5.1 py_1 conda-forge
    wheel 0.35.1 pyh9f0ad1d_0 conda-forge
    wincertstore 0.2 py38h32f6830_1005 conda-forge
    winpty 0.4.3 4 conda-forge
    xarray 0.16.1 py_0 conda-forge
    xz 5.2.5 h62dcd97_1 conda-forge
    zeromq 4.3.2 ha925a31_4 conda-forge
    zipp 3.3.1 py_0 conda-forge
    zlib 1.2.11 h62dcd97_1010 conda-forge
    zstd 1.4.5 h1f3a1b7_2 conda-forge
    Matthew Castino

    Hi. Newbie here. I'm running the code in 2.6 (computing posterior using quadriatic approximation) and getting the follow errors. Is that to be expected?

    UserWarning: grad method was asked to compute the gradient with respect to a variable that is not part of the computational graph of the cost, or is used only by a non-differentiable operator: <DisconnectedType> handle_disconnected(rval[i])

    <ipython-input-8-b8607afb3021>:6: RuntimeWarning: divide by zero encountered in true_divide
    std_q = ((1 / pm.find_hessian(mean_q, vars=[p])) ** 0.5)[0]
    <ipython-input-8-b8607afb3021>:6: RuntimeWarning: invalid value encountered in sqrt
    std_q = ((1 / pm.find_hessian(mean_q, vars=[p])) ** 0.5)[0]

    Osvaldo Martin
    Hi @mcastino Did you change something in the code? It seems that you are trying to compute the Hessian with respect to a variable that is not actually part of the model.
    Matthew Castino
    I thought I did but I re-pulled from gh and same error
    Osvaldo Martin
    This is really weird, I just tried to reproduce and as expected I can not. Which PyMC3 version are you using?
    Matthew Castino
    i installed the conda env as per instructions
    You are running the v4 development version of PyMC3 which currently still lacks key features. You probably want to use the stable v3 instead which you can either install via conda or find on the v3 GitHub branch: https://github.com/pymc-devs/pymc3/tree/v3
    maybe this is the issue?
    Osvaldo Martin
    yeah, most likely
    Matthew Castino
    any advice on how to install previous version?
    looks like the gh link above is now at v4
    Osvaldo Martin
    use conda install -c conda-forge pymc3 for the last stable release
    Matthew Castino
    thanks. running this fixed my problem conda install -c conda-forge mkl pymc3 theano-pymc
    Osvaldo Martin
    Matthew Castino


    thanks for your help!

    David Saroff
    I'm having a problem with installation on a Windows 10. The last statement of the
    environment.yml is
    throwing an error. Has anyone else seen this?
    David Saroff
    this is what I tried
    open an Anaconda powershell prompt window.
    position to the file cloned from https://github.com/pymc-devs/resources/tree/master/Rethinking_2
    conda env create -f environment.yml
    this throws a pip error

    I try explicitly installing pymc3 like this
    pip install pymc3
    conda install m2w64-toolchain
    jupyter notebook
    I try Chp_02
    theano throws a compilation error

    Has anyone sucessfully installed and run the notebooks on Windows 10?

    1 reply
    Ivan Savov
    Hi All. Richard has started posting new video lectures for the course called "Statistical Rethinking 2022". Here is the relevant youtube playlist https://www.youtube.com/playlist?list=PLDcUM9US4XdMROZ57-OIRtIK0aOynbgZN
    and this repo has links to slides: https://github.com/rmcelreath/stat_rethinking_2022 It's still just the first week, so only two videos posted.
    Thanks to all who contributed to Rethinking_2 notebooks. I'm using binder to play with them today, and it's very useful to be able to follow along with Python, see https://mybinder.org/v2/gh/pymc-devs/resources/HEAD?labpath=Rethinking_2
    Luke Lewis-Borrell
    Hey all! I've been working through Richard's book with this excellent PyMC port. I'm a little confused by the link function Richard uses, is there an obvious reason I'm missing why such a function hasn't been written for PyMC/ArViz? It seems it would save a lot of time rather than having to write a new code out each time for a new model. An example of this is in code 4.54.
    David Saroff
    Can someone coach me, a binder beginner, how to run the notebooks at link

    When I run Chp_02.ipynb, I get the error

    ModuleNotFoundError Traceback (most recent call last)
    /tmp/ipykernel_105/2622655452.py in <module>
    ----> 1 import arviz as az
    2 import matplotlib.pyplot as plt
    3 import numpy as np
    4 import pymc3 as pm
    5 import scipy.stats as stats

    ModuleNotFoundError: No module named 'arviz'

    apparently I don't know how to use the environment.yml
    to initialize the environment. Sorry for the binder newbiness...

    Ravin Kumar
    hey @davidsaroff_gitlab Sorry about that
    easiest thing to do is in the notebook run !pip install arviz
    that should get arviz in the environment for you, not the cleanest way but itll get the job done