diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 343b90a..50f8713 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,6 @@ # Thank you for opening a pull request! + Please check our [style guide](https://docs.pymc.io/en/latest/contributing/jupyter_style.html), and also make sure that the notebooks you've modified pass the `pre-commit` checks. If, for example, you modified `notebook1.ipynb` and `notebook2.ipynb`, you could do this by running: ```bash diff --git a/BCM/CaseStudies/ExtrasensoryPerception.ipynb b/BCM/CaseStudies/ExtrasensoryPerception.ipynb index a80b0b8..6c0b039 100644 --- a/BCM/CaseStudies/ExtrasensoryPerception.ipynb +++ b/BCM/CaseStudies/ExtrasensoryPerception.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "\n", "from matplotlib import gridspec\n", @@ -623,7 +623,7 @@ "output_type": "stream", "text": [ "arviz 0.7.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "scipy 1.3.1\n", "numpy 1.17.3\n", "last updated: Mon Apr 27 2020 \n", diff --git a/BCM/CaseStudies/HeuristicDecisionMaking.ipynb b/BCM/CaseStudies/HeuristicDecisionMaking.ipynb index 6b614f2..fd274e9 100644 --- a/BCM/CaseStudies/HeuristicDecisionMaking.ipynb +++ b/BCM/CaseStudies/HeuristicDecisionMaking.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.io as sio\n", "\n", "from scipy import stats\n", @@ -179,7 +179,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/pymc3/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/pymc/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " \"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] }, @@ -564,7 +564,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/ipykernel_launcher.py:8: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/ipykernel_launcher.py:8: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " \n" ] }, @@ -769,7 +769,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/pymc3/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/pymc/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " \"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] }, @@ -844,7 +844,7 @@ "text": [ "numpy 1.18.1\n", "arviz 0.7.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "last updated: Mon Apr 27 2020 \n", "\n", "CPython 3.7.7\n", @@ -861,7 +861,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/MemoryRetention.ipynb b/BCM/CaseStudies/MemoryRetention.ipynb index 8cdce08..65fb879 100644 --- a/BCM/CaseStudies/MemoryRetention.ipynb +++ b/BCM/CaseStudies/MemoryRetention.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "import theano\n", "\n", @@ -994,7 +994,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "pymc3 3.8\n", + "pymc 3.8\n", "pandas 1.0.3\n", "arviz 0.7.0\n", "seaborn 0.10.0\n", @@ -1016,7 +1016,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/MultinomialProcessingTrees.ipynb b/BCM/CaseStudies/MultinomialProcessingTrees.ipynb index ce7c601..65c4b58 100644 --- a/BCM/CaseStudies/MultinomialProcessingTrees.ipynb +++ b/BCM/CaseStudies/MultinomialProcessingTrees.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.special as sp\n", "import theano\n", "\n", @@ -859,7 +859,7 @@ "output_type": "stream", "text": [ "numpy 1.18.1\n", - "pymc3 3.8\n", + "pymc 3.8\n", "theano 1.0.4\n", "arviz 0.7.0\n", "last updated: Mon Apr 27 2020 \n", @@ -878,7 +878,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/NumberConceptDevelopment.ipynb b/BCM/CaseStudies/NumberConceptDevelopment.ipynb index 800546f..1a7be7c 100644 --- a/BCM/CaseStudies/NumberConceptDevelopment.ipynb +++ b/BCM/CaseStudies/NumberConceptDevelopment.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.io as sio\n", "import theano\n", "\n", @@ -1024,7 +1024,7 @@ "text": [ "theano 1.0.4\n", "numpy 1.18.1\n", - "pymc3 3.8\n", + "pymc 3.8\n", "arviz 0.7.0\n", "last updated: Mon Apr 27 2020 \n", "\n", @@ -1042,7 +1042,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/PsychophysicalFunctions.ipynb b/BCM/CaseStudies/PsychophysicalFunctions.ipynb index ef6492c..9498009 100644 --- a/BCM/CaseStudies/PsychophysicalFunctions.ipynb +++ b/BCM/CaseStudies/PsychophysicalFunctions.ipynb @@ -10,11 +10,11 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano\n", "\n", "from matplotlib import gridspec\n", - "from pymc3.step_methods.hmc import quadpotential\n", + "from pymc.step_methods.hmc import quadpotential\n", "from scipy import stats\n", "from theano import tensor as tt\n", "\n", @@ -1169,7 +1169,7 @@ "numpy 1.18.1\n", "theano 1.0.4\n", "arviz 0.7.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "pandas 1.0.3\n", "last updated: Mon Apr 27 2020 \n", "\n", @@ -1187,7 +1187,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/SignalDetectionTheory.ipynb b/BCM/CaseStudies/SignalDetectionTheory.ipynb index b7a9c53..cbe09f6 100644 --- a/BCM/CaseStudies/SignalDetectionTheory.ipynb +++ b/BCM/CaseStudies/SignalDetectionTheory.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from matplotlib.patches import Polygon\n", @@ -672,7 +672,7 @@ "metadata": {}, "source": [ "### Note from Junpeng Lao\n", - "Sampling using HMC (e.g., in STAN and PyMC3), there are better way to diagnose biased inference [[1]](http://mc-stan.org/documentation/case-studies/divergences_and_bias.html), [[2]](http://pymc-devs.github.io/pymc3/notebooks/Diagnosing_biased_Inference_with_Divergences.html)." + "Sampling using HMC (e.g., in STAN and PyMC), there are better way to diagnose biased inference [[1]](http://mc-stan.org/documentation/case-studies/divergences_and_bias.html), [[2]](http://pymc-devs.github.io/pymc/notebooks/Diagnosing_biased_Inference_with_Divergences.html)." ] }, { @@ -819,7 +819,7 @@ "source": [ "As shown above, there are a lot of divergences in the trace, and the energy plot is very different from the energy_diff. This is a strong indication of bias in the estimation, and better reparameterization is needed.\n", "\n", - "Moreover, the reparameterization, which works better in BUGS/JAGS using Gibbs sampler, actually perform worse using NUTS. Again, this demonstrates that many of the tricks and intuition we got using BUGS/JAGS might not translate to PyMC3 and STAN." + "Moreover, the reparameterization, which works better in BUGS/JAGS using Gibbs sampler, actually perform worse using NUTS. Again, this demonstrates that many of the tricks and intuition we got using BUGS/JAGS might not translate to PyMC and STAN." ] }, { @@ -1061,7 +1061,7 @@ "output_type": "stream", "name": "stdout", "text": [ - "seaborn 0.11.0\npymc3 3.9.2\npandas 1.0.3\narviz 0.10.0\nnumpy 1.18.2\nlast updated: Mon Nov 23 2020 \n\nCPython 3.8.5\nIPython 7.13.0\nwatermark 2.0.2\n" + "seaborn 0.11.0\npymc 3.9.2\npandas 1.0.3\narviz 0.10.0\nnumpy 1.18.2\nlast updated: Mon Nov 23 2020 \n\nCPython 3.8.5\nIPython 7.13.0\nwatermark 2.0.2\n" ] } ], diff --git a/BCM/CaseStudies/TheBARTModelofRiskTaking.ipynb b/BCM/CaseStudies/TheBARTModelofRiskTaking.ipynb index 9b32f15..575ad25 100644 --- a/BCM/CaseStudies/TheBARTModelofRiskTaking.ipynb +++ b/BCM/CaseStudies/TheBARTModelofRiskTaking.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy import stats\n", "from theano import tensor as tt\n", @@ -463,7 +463,7 @@ "text": [ "numpy 1.18.1\n", "arviz 0.7.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "pandas 1.0.3\n", "last updated: Tue Apr 28 2020 \n", "\n", @@ -481,7 +481,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/TheGCMModelofCategorization.ipynb b/BCM/CaseStudies/TheGCMModelofCategorization.ipynb index f7ce805..b478256 100644 --- a/BCM/CaseStudies/TheGCMModelofCategorization.ipynb +++ b/BCM/CaseStudies/TheGCMModelofCategorization.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.io as sio\n", "import seaborn as sns\n", "import theano\n", @@ -201,7 +201,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/pymc3/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/pymc/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " \"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] }, @@ -696,7 +696,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/pymc3/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/pymc/sampling.py:1585: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " \"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] }, @@ -778,7 +778,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "pymc3 3.8\n", + "pymc 3.8\n", "pandas 1.0.3\n", "numpy 1.18.1\n", "arviz 0.7.0\n", @@ -800,7 +800,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/CaseStudies/TheSIMPLEModelofMemory.ipynb b/BCM/CaseStudies/TheSIMPLEModelofMemory.ipynb index 6ab51f4..2dc9361 100644 --- a/BCM/CaseStudies/TheSIMPLEModelofMemory.ipynb +++ b/BCM/CaseStudies/TheSIMPLEModelofMemory.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy import stats\n", "from theano import tensor as tt\n", @@ -830,7 +830,7 @@ "pandas 1.0.3\n", "numpy 1.18.1\n", "arviz 0.7.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "last updated: Tue Apr 28 2020 \n", "\n", "CPython 3.7.7\n", @@ -847,7 +847,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/ModelSelection/ComparingBinomialRates.ipynb b/BCM/ModelSelection/ComparingBinomialRates.ipynb index 402a035..4fc5c8d 100644 --- a/BCM/ModelSelection/ComparingBinomialRates.ipynb +++ b/BCM/ModelSelection/ComparingBinomialRates.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano.tensor as tt\n", "\n", "from scipy import stats\n", @@ -1246,7 +1246,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "pymc3 3.9.2\n", + "pymc 3.9.2\n", "numpy 1.18.2\n", "arviz 0.10.0\n", "last updated: Thu Nov 19 2020 \n", diff --git a/BCM/ModelSelection/ComparingGaussianMeans.ipynb b/BCM/ModelSelection/ComparingGaussianMeans.ipynb index 1945ec9..f257f56 100644 --- a/BCM/ModelSelection/ComparingGaussianMeans.ipynb +++ b/BCM/ModelSelection/ComparingGaussianMeans.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy import stats\n", "\n", @@ -632,7 +632,7 @@ "pandas 1.0.3\n", "arviz 0.7.0\n", "numpy 1.18.1\n", - "pymc3 3.8\n", + "pymc 3.8\n", "last updated: Sat Apr 25 2020 \n", "\n", "CPython 3.7.7\n", @@ -649,7 +649,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/ParameterEstimation/Binomial.ipynb b/BCM/ParameterEstimation/Binomial.ipynb index 3303e15..6f721db 100644 --- a/BCM/ParameterEstimation/Binomial.ipynb +++ b/BCM/ParameterEstimation/Binomial.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from matplotlib import gridspec\n", @@ -262,7 +262,7 @@ "\n", "In the example, we set k1 = 5, n1 = 10 and k2 = 7, n2 = 10 \n", "\n", - "The model involve a deterministic part in pymc3." + "The model involve a deterministic part in pymc." ] }, { @@ -1175,7 +1175,7 @@ "metadata": {}, "source": [ "### Note from Junpeng Lao\n", - "It is obvious from the above posterior plot that the geometry of the posterior is quite nasty. We can see that in the trace as well: the mixing is quite poor, with strong autocorrelation. There is no divergence warning, but it could just be that PyMC3 is mixing Metropolis and NUTS together due to the discrete variable. \n", + "It is obvious from the above posterior plot that the geometry of the posterior is quite nasty. We can see that in the trace as well: the mixing is quite poor, with strong autocorrelation. There is no divergence warning, but it could just be that PyMC is mixing Metropolis and NUTS together due to the discrete variable. \n", "\n", "In this particular case, it is not a big deal as we can visualize the posterior directly. However, when we are sampling larger models, it is definitely going to be a problem.\n", "Actually, we don't necessary need to use `DiscreteUniform` for `TotalN`, as the computation of logp in Binomial doesn't require n to be an integer." @@ -1339,7 +1339,7 @@ "numpy 1.18.1\n", "arviz 0.7.0\n", "seaborn 0.10.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "last updated: Fri Apr 24 2020 \n", "\n", "CPython 3.7.7\n", @@ -1356,7 +1356,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/ParameterEstimation/DataAnalysis.ipynb b/BCM/ParameterEstimation/DataAnalysis.ipynb index ac98014..9835fc9 100644 --- a/BCM/ParameterEstimation/DataAnalysis.ipynb +++ b/BCM/ParameterEstimation/DataAnalysis.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from matplotlib import gridspec\n", "from scipy import corrcoef, stats\n", @@ -55,7 +55,7 @@ "\n", "The observed data take the form _xi_ = (_xi1_, _xi2_) for the ith observation, and, following the theory behind the correlation coefficient, are modeled as draws from a multivariate Gaussian distribution. The parameters of this distribution are the means _μ_ = (_μ1_,_μ2_) and standard deviations _σ_ = (_σ1_,_σ2_) of the two variables, and the correlation coefficient _r_ that links them.\n", "\n", - "**NB: This model runs with PyMC 3.8, but not with the master branch -- probably related to [this issue](https://github.com/pymc-devs/pymc3/issues/3884).**" + "**NB: This model runs with PyMC 3.8, but not with the master branch -- probably related to [this issue](https://github.com/pymc-devs/pymc/issues/3884).**" ] }, { @@ -890,7 +890,7 @@ "output_type": "stream", "name": "stdout", "text": [ - "arviz 0.10.0\npymc3 3.9.2\npandas 1.0.3\nnumpy 1.18.2\nlast updated: Sun Nov 15 2020 \n\nCPython 3.8.5\nIPython 7.13.0\nwatermark 2.0.2\n" + "arviz 0.10.0\npymc 3.9.2\npandas 1.0.3\nnumpy 1.18.2\nlast updated: Sun Nov 15 2020 \n\nCPython 3.8.5\nIPython 7.13.0\nwatermark 2.0.2\n" ] } ], diff --git a/BCM/ParameterEstimation/Gaussian.ipynb b/BCM/ParameterEstimation/Gaussian.ipynb index e519a54..6224b65 100644 --- a/BCM/ParameterEstimation/Gaussian.ipynb +++ b/BCM/ParameterEstimation/Gaussian.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "%config InlineBackend.figure_format = 'retina'\n", "RANDOM_SEED = 8927\n", @@ -827,7 +827,7 @@ "text": [ "arviz 0.7.0\n", "pandas 1.0.3\n", - "pymc3 3.8\n", + "pymc 3.8\n", "numpy 1.18.1\n", "last updated: Sat Apr 25 2020 \n", "\n", @@ -845,7 +845,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/ParameterEstimation/Latent-mixtureModels.ipynb b/BCM/ParameterEstimation/Latent-mixtureModels.ipynb index c097915..85db73a 100644 --- a/BCM/ParameterEstimation/Latent-mixtureModels.ipynb +++ b/BCM/ParameterEstimation/Latent-mixtureModels.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano.tensor as tt\n", "\n", "from matplotlib import gridspec\n", @@ -38,7 +38,7 @@ "metadata": {}, "source": [ "### Note from Junpeng Lao\n", - "In PyMC3, a discrete latent variable could be very easily expressed as a discrete random variable. PyMC3 will assign this discrete variable with a sampler (usually a Metropolis sampler), while the rest of the (continous) RVs sample with NUTS. However, care must be taken, as the correctness of mixing different sampler is in general not guaranteed. The standard treatment is integrate out the latent variables, as done in Stan." + "In PyMC, a discrete latent variable could be very easily expressed as a discrete random variable. PyMC will assign this discrete variable with a sampler (usually a Metropolis sampler), while the rest of the (continous) RVs sample with NUTS. However, care must be taken, as the correctness of mixing different sampler is in general not guaranteed. The standard treatment is integrate out the latent variables, as done in Stan." ] }, { @@ -263,7 +263,7 @@ } ], "source": [ - "# pymc3 - need some tuning to get the same result as in JAGS\n", + "# pymc - need some tuning to get the same result as in JAGS\n", "k = np.array([21, 17, 21, 18, 22, 31, 31, 34, 34, 35, 35, 36, 39, 36, 35])\n", "p = len(k) # number of people\n", "n = 40 # number of questions\n", @@ -376,7 +376,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/pymc3/model.py:1515: ImputationWarning: Data in kij contains missing values and will be automatically imputed from the sampling distribution.\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/pymc/model.py:1515: ImputationWarning: Data in kij contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, ImputationWarning)\n", "Multiprocess sampling (4 chains in 4 jobs)\n", "CompoundStep\n", @@ -576,7 +576,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/pymc3/model.py:1515: ImputationWarning: Data in kij contains missing values and will be automatically imputed from the sampling distribution.\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/pymc/model.py:1515: ImputationWarning: Data in kij contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, ImputationWarning)\n", "Multiprocess sampling (4 chains in 4 jobs)\n", "CompoundStep\n", @@ -752,7 +752,7 @@ "output_type": "stream", "text": [ "Sampling 4 chains for 1_000 tune and 3_000 draw iterations (4_000 + 12_000 draws total) took 8 seconds.\n", - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/xarray/core/nputils.py:215: RuntimeWarning: All-NaN slice encountered\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/xarray/core/nputils.py:215: RuntimeWarning: All-NaN slice encountered\n", " result = getattr(npmodule, name)(values, axis=axis, **kwargs)\n" ] }, @@ -884,7 +884,7 @@ "output_type": "stream", "text": [ "Sampling 4 chains for 1_000 tune and 1_000 draw iterations (4_000 + 4_000 draws total) took 8 seconds.\n", - "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc3/lib/python3.7/site-packages/xarray/core/nputils.py:215: RuntimeWarning: All-NaN slice encountered\n", + "/Users/alex_andorra/opt/anaconda3/envs/BCM_pymc/lib/python3.7/site-packages/xarray/core/nputils.py:215: RuntimeWarning: All-NaN slice encountered\n", " result = getattr(npmodule, name)(values, axis=axis, **kwargs)\n", "There was 1 divergence after tuning. Increase `target_accept` or reparameterize.\n", "There was 1 divergence after tuning. Increase `target_accept` or reparameterize.\n" @@ -1306,7 +1306,7 @@ "numpy 1.18.1\n", "pandas 1.0.3\n", "arviz 0.7.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "last updated: Sat Apr 25 2020 \n", "\n", "CPython 3.7.7\n", @@ -1323,7 +1323,7 @@ ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BCM/README.md b/BCM/README.md index 61f9e33..6099406 100644 --- a/BCM/README.md +++ b/BCM/README.md @@ -1,5 +1,5 @@ -# Bayesian Cognitive Modeling in PyMC3 -PyMC3 port of Lee and Wagenmakers' [Bayesian Cognitive Modeling - A Practical Course](http://bayesmodels.com) +# Bayesian Cognitive Modeling in PyMC +PyMC port of Lee and Wagenmakers' [Bayesian Cognitive Modeling - A Practical Course](http://bayesmodels.com) All the codes are in jupyter notebooks with the model explained in distributions (as in the book). @@ -8,8 +8,8 @@ All the codes are in jupyter notebooks with the model explained in distributions [](http://nbviewer.jupyter.org/github/pymc-devs/resources/blob/master/BCM/index.ipynb) # Notice: -This repository is tested under [PyMC3](https://github.com/pymc-devs/pymc3) v3.8 master with [theano](https://github.com/Theano/Theano) 1.0.4 +This repository is tested under [PyMC](https://github.com/pymc-devs/pymc) v3.8 master with [theano](https://github.com/Theano/Theano) 1.0.4 --- -Creative Commons License
Bayesian Cognitive Modeling in PyMC3 by Junpeng Lao is licensed under a Creative Commons Attribution 4.0 International License. +Creative Commons License
Bayesian Cognitive Modeling in PyMC by Junpeng Lao is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/BCM/environment.yml b/BCM/environment.yml index 99d17e1..299344e 100644 --- a/BCM/environment.yml +++ b/BCM/environment.yml @@ -1,4 +1,4 @@ -name: BCM_pymc3 +name: BCM_pymc channels: - defaults dependencies: @@ -8,5 +8,5 @@ dependencies: - statsmodels - pip - pip: - - "git+git://github.com/pymc-devs/pymc3.git@main" + - "git+git://github.com/pymc-devs/pymc.git@main" - watermark \ No newline at end of file diff --git a/BCM/index.ipynb b/BCM/index.ipynb index 8d89a64..358a7e2 100644 --- a/BCM/index.ipynb +++ b/BCM/index.ipynb @@ -4,12 +4,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Bayesian Cognitive Modeling in PyMC3\n", - "PyMC3 port of Lee and Wagenmakers' [Bayesian Cognitive Modeling - A Practical Course](http://bayesmodels.com)\n", + "# Bayesian Cognitive Modeling in PyMC\n", + "PyMC port of Lee and Wagenmakers' [Bayesian Cognitive Modeling - A Practical Course](http://bayesmodels.com)\n", "\n", "All the codes are in jupyter notebooks with the model explained in distributions (as in the book). Background information of the models please consult the book. You can also compare the result with the original code associated with the book ([WinBUGS and JAGS](https://webfiles.uci.edu/mdlee/Code.zip); [Stan](https://github.com/stan-dev/example-models/tree/master/Bayesian_Cognitive_Modeling))\n", "\n", - "_All the codes are currently tested under PyMC3 v3.8 master with theano 1.0.4_" + "_All the codes are currently tested under PyMC v3.8 master with theano 1.0.4_" ] }, { @@ -141,7 +141,7 @@ "CPython 3.7.7\n", "IPython 7.13.0\n", "\n", - "pymc3 3.8\n", + "pymc 3.8\n", "theano 1.0.4\n", "scipy 1.4.1\n", "numpy 1.18.1\n", @@ -163,13 +163,13 @@ "source": [ "# Python Environment and library version\n", "%load_ext watermark\n", - "%watermark -v -n -u -w -p pymc3,theano,scipy,numpy,pandas,matplotlib,seaborn -m" + "%watermark -v -n -u -w -p pymc,theano,scipy,numpy,pandas,matplotlib,seaborn -m" ] } ], "metadata": { "kernelspec": { - "display_name": "BCM_pymc3", + "display_name": "BCM_pymc", "language": "python", "name": "bcm_pymc3" }, diff --git a/BDA3/README.md b/BDA3/README.md index 7a05fb7..9f0f3d1 100644 --- a/BDA3/README.md +++ b/BDA3/README.md @@ -1,8 +1,8 @@ -# Bayesian Data Analysis with Python and PyMC3 +# Bayesian Data Analysis with Python and PyMC [Bayesian Data Analysis](http://www.stat.columbia.edu/~gelman/book/) by Gelman, Carlin, Stern, Dunson, Vehtari, and Rubin is a comprehensive, standard, and wonderful textbook on Bayesian Methods. There currently exist code for examples in the book in [R](https://github.com/avehtari/BDA_R_demos), [Python](https://github.com/avehtari/BDA_py_demos), and [Matlab](https://github.com/avehtari/BDA_m_demos), all using the [Stan](http://mc-stan.org/) language. -This repository is a work in progress, organizing work on porting examples and exercises to Python and PyMC3. Please open a pull request on the README to indicate interest in a chapter or section! +This repository is a work in progress, organizing work on porting examples and exercises to Python and PyMC. Please open a pull request on the README to indicate interest in a chapter or section! ## Chapters @@ -116,8 +116,8 @@ Anaconda, run: to install all the dependencies into an isolated environment. You can switch to this environment by running: - source activate bda3-pymc3 + source activate bda3-pymc --- -Creative Commons License
Bayesian Data Analysis with Python and PyMC3 by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. +Creative Commons License
Bayesian Data Analysis with Python and PyMC by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/BDA3/chap_02.ipynb b/BDA3/chap_02.ipynb index 1a1643f..1956716 100644 --- a/BDA3/chap_02.ipynb +++ b/BDA3/chap_02.ipynb @@ -24,7 +24,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy.special import expit" ] @@ -247,7 +247,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The true posterior distribution is $\\textsf{Beta}(438, 544)$. Let's compare it with the one we found using `pymc3`." + "The true posterior distribution is $\\textsf{Beta}(438, 544)$. Let's compare it with the one we found using `pymc`." ] }, { @@ -1141,7 +1141,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The true posterior distribution is $\\textsf{Gamma}(6,7)$. Let's compare it with the one we found using `pymc3`." + "The true posterior distribution is $\\textsf{Gamma}(6,7)$. Let's compare it with the one we found using `pymc`." ] }, { @@ -1461,7 +1461,7 @@ "output_type": "stream", "text": [ "numpy 1.18.1\n", - "pymc3 3.8\n", + "pymc 3.8\n", "arviz 0.7.0\n", "CPython 3.6.8\n", "IPython 7.12.0\n", diff --git a/BDA3/chap_03.ipynb b/BDA3/chap_03.ipynb index acb1e9e..1964553 100644 --- a/BDA3/chap_03.ipynb +++ b/BDA3/chap_03.ipynb @@ -36,7 +36,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from scipy.optimize import brentq\n", @@ -131,7 +131,7 @@ { "cell_type": "markdown", "source": [ - "And now, we use `pymc3` to estimate the mean and the standard deviation from the data." + "And now, we use `pymc` to estimate the mean and the standard deviation from the data." ], "metadata": {} }, @@ -1177,7 +1177,7 @@ "output_type": "stream", "name": "stderr", "text": [ - "/home/xyj/anaconda3/lib/python3.8/site-packages/pymc3/sampling.py:1689: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/xyj/anaconda3/lib/python3.8/site-packages/pymc/sampling.py:1689: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -1681,7 +1681,7 @@ "Architecture: 64bit\n", "\n", "arviz : 0.11.2\n", - "pymc3 : 3.11.4\n", + "pymc : 3.11.4\n", "matplotlib: 3.3.4\n", "theano : 1.1.2\n", "sys : 3.8.8 (default, Apr 13 2021, 19:58:26) \n", diff --git a/BDA3/chap_05.ipynb b/BDA3/chap_05.ipynb index b8e7e0c..4177377 100644 --- a/BDA3/chap_05.ipynb +++ b/BDA3/chap_05.ipynb @@ -10,7 +10,7 @@ "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano.tensor as tt" ] }, @@ -454,7 +454,7 @@ "\n", "In order to use this prior, you have to define the logarithm of $p(\\alpha, \\beta)$ and use it in `pm.Potential`, [look here][2]. \n", "\n", - "[1]:https://github.com/pymc-devs/pymc3/blob/master/docs/source/notebooks/GLM-hierarchical-binominal-model.ipynb\n", + "[1]:https://github.com/pymc-devs/pymc/blob/master/docs/source/notebooks/GLM-hierarchical-binominal-model.ipynb\n", "[2]:https://discourse.pymc.io/t/difference-between-densitydist-and-potential/307/4" ] }, @@ -750,7 +750,7 @@ "Attributes:\n", " created_at: 2020-04-24T21:27:00.254444\n", " arviz_version: 0.7.0\n", - " inference_library: pymc3\n", + " inference_library: pymc\n", " inference_library_version: 3.8" ], "text/plain": [ @@ -771,7 +771,7 @@ "Attributes:\n", " created_at: 2020-04-24T21:27:00.254444\n", " arviz_version: 0.7.0\n", - " inference_library: pymc3\n", + " inference_library: pymc\n", " inference_library_version: 3.8" ] }, @@ -1370,7 +1370,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/rpg/src/pymc3/pymc3/distributions/posterior_predictive.py:203: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/Users/rpg/src/pymc/pymc/distributions/posterior_predictive.py:203: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] } @@ -1672,7 +1672,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Ok, so the results are not quite good, I mean, there are a lot of discrepancies and the differences are notorious when you compare the two histograms previously showed with the Figure 5.8 (even more if you compare it with Table 5.3). Yes, the question is: Why does this happen? Is the algorithm behind `pymc3` the reason of all this? I would say that priors are really bad and the geometry behind the model is nasty. More info here: https://docs.pymc.io/notebooks/Diagnosing_biased_Inference_with_Divergences.html" + "Ok, so the results are not quite good, I mean, there are a lot of discrepancies and the differences are notorious when you compare the two histograms previously showed with the Figure 5.8 (even more if you compare it with Table 5.3). Yes, the question is: Why does this happen? Is the algorithm behind `pymc` the reason of all this? I would say that priors are really bad and the geometry behind the model is nasty. More info here: https://docs.pymc.io/notebooks/Diagnosing_biased_Inference_with_Divergences.html" ] }, { @@ -2220,7 +2220,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "pymc3 3.8\n", + "pymc 3.8\n", "matplotlib 3.1.3\n", "arviz 0.7.0\n", "numpy 1.18.1\n", diff --git a/BDA3/chap_06.ipynb b/BDA3/chap_06.ipynb index 62312d0..fd91a15 100644 --- a/BDA3/chap_06.ipynb +++ b/BDA3/chap_06.ipynb @@ -18,7 +18,7 @@ "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "import theano.tensor as tt\n", "\n", @@ -735,7 +735,7 @@ "output_type": "stream", "text": [ "numpy 1.15.0\n", - "pymc3 3.5\n", + "pymc 3.5\n", "seaborn 0.9.0\n", "CPython 3.6.6\n", "IPython 7.1.1\n", diff --git a/BDA3/chap_07.ipynb b/BDA3/chap_07.ipynb index 51cbe78..a17f13f 100644 --- a/BDA3/chap_07.ipynb +++ b/BDA3/chap_07.ipynb @@ -20,7 +20,7 @@ "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano.tensor as tt\n", "\n", "from scipy import stats\n", @@ -1948,7 +1948,7 @@ "output_type": "stream", "text": [ "numpy 1.16.2\n", - "pymc3 3.6\n", + "pymc 3.6\n", "CPython 3.6.7\n", "IPython 7.3.0\n", "\n", diff --git a/BDA3/environment.yml b/BDA3/environment.yml index 9d06fd4..2e83e66 100644 --- a/BDA3/environment.yml +++ b/BDA3/environment.yml @@ -1,4 +1,4 @@ -name: bda3-pymc3 +name: bda3-pymc channels: - defaults dependencies: @@ -6,4 +6,4 @@ dependencies: - seaborn - pip - pip: - - "git+git://github.com/pymc-devs/pymc3.git@main" + - "git+git://github.com/pymc-devs/pymc.git@main" diff --git a/BSM/Chapter_03_09_Simple_linear_regression_in_PyMC3.ipynb b/BSM/Chapter_03_09_Simple_linear_regression_in_PyMC3.ipynb index a21ef0b..072a1aa 100644 --- a/BSM/Chapter_03_09_Simple_linear_regression_in_PyMC3.ipynb +++ b/BSM/Chapter_03_09_Simple_linear_regression_in_PyMC3.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { @@ -25,11 +25,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Using PyMC3 for MCMC sampling\n", + "# Using PyMC for MCMC sampling\n", "\n", - "### Chapter 3.3: Introduction to PyMC3\n", + "### Chapter 3.3: Introduction to PyMC\n", "\n", - "In this example, we use PyMC3 to conduct simple linear regression.\n", + "In this example, we use PyMC to conduct simple linear regression.\n", "\n", "The response is the mass of a T. Rex and the covariate is the age. The model is:\n", "\n", diff --git a/BSM/Chapter_03_10_Poisson_gamma_model_in_PyMC3.ipynb b/BSM/Chapter_03_10_Poisson_gamma_model_in_PyMC3.ipynb index 6755610..f0f6aa4 100644 --- a/BSM/Chapter_03_10_Poisson_gamma_model_in_PyMC3.ipynb +++ b/BSM/Chapter_03_10_Poisson_gamma_model_in_PyMC3.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { @@ -27,7 +27,7 @@ "source": [ "# Using JAGS for concussions data\n", "\n", - "## Chapter 3.3: Introduction to PyMC3\n", + "## Chapter 3.3: Introduction to PyMC\n", "\n", "The response is the total number of concussions (summing across teams and games) in each year from 2012-2015. We fit the model\n", "\n", @@ -37,7 +37,7 @@ "\n", "\n", "\n", - "We have previously coded Gibbs sampling for this problem, and here e verify that we obtain the same results using PyMC3." + "We have previously coded Gibbs sampling for this problem, and here e verify that we obtain the same results using PyMC." ] }, { diff --git a/BSM/Chapter_03_11_Convergence_diagnostics_for_a_ill_posed_model.ipynb b/BSM/Chapter_03_11_Convergence_diagnostics_for_a_ill_posed_model.ipynb index f7684f3..4b54a1b 100644 --- a/BSM/Chapter_03_11_Convergence_diagnostics_for_a_ill_posed_model.ipynb +++ b/BSM/Chapter_03_11_Convergence_diagnostics_for_a_ill_posed_model.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { diff --git a/BSM/Chapter_03_12_Convergence_diagnostics_for_a_well_behaved_model.ipynb b/BSM/Chapter_03_12_Convergence_diagnostics_for_a_well_behaved_model.ipynb index 86f2593..97ec04b 100644 --- a/BSM/Chapter_03_12_Convergence_diagnostics_for_a_well_behaved_model.ipynb +++ b/BSM/Chapter_03_12_Convergence_diagnostics_for_a_well_behaved_model.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { diff --git a/BSM/Chapter_04_01_Logistic_regression_for_NBA_clutch_free_throws.ipynb b/BSM/Chapter_04_01_Logistic_regression_for_NBA_clutch_free_throws.ipynb index 4c5471d..8dfc649 100644 --- a/BSM/Chapter_04_01_Logistic_regression_for_NBA_clutch_free_throws.ipynb +++ b/BSM/Chapter_04_01_Logistic_regression_for_NBA_clutch_free_throws.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { diff --git a/BSM/Chapter_04_03_One-way_random_effects_model_for_the_jaw_data.ipynb b/BSM/Chapter_04_03_One-way_random_effects_model_for_the_jaw_data.ipynb index b7d586f..5418a81 100644 --- a/BSM/Chapter_04_03_One-way_random_effects_model_for_the_jaw_data.ipynb +++ b/BSM/Chapter_04_03_One-way_random_effects_model_for_the_jaw_data.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { diff --git a/BSM/README.md b/BSM/README.md index edfc2f4..bdaec56 100644 --- a/BSM/README.md +++ b/BSM/README.md @@ -1,6 +1,6 @@ -# Bayesian Statistical Methods Python and PyMC3 +# Bayesian Statistical Methods Python and PyMC -In this repository we port [the book's original code](https://bayessm.wordpress.ncsu.edu) to Python and PyMC3. We attempt to reproduce the examples as faithfully as possible while expressing them in a _Pythonic_ and _PyMC3onic_ way. +In this repository we port [the book's original code](https://bayessm.wordpress.ncsu.edu) to Python and PyMC. We attempt to reproduce the examples as faithfully as possible while expressing them in a _Pythonic_ and _PyMConic_ way. ## Display notebooks [![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/pymc-devs/resources/master?filepath=BSM) @@ -23,8 +23,8 @@ to install all the dependencies into an isolated environment. Activate the environment by running: - source activate bsm-pymc3 + source activate bsm-pymc --- -Creative Commons License
Statistical Rethinking with Python and PyMC3 by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. +Creative Commons License
Statistical Rethinking with Python and PyMC by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/BSM/environment.yml b/BSM/environment.yml index a0e14c5..e64d2ec 100644 --- a/BSM/environment.yml +++ b/BSM/environment.yml @@ -1,4 +1,4 @@ -name: bsm-pymc3 +name: bsm-pymc channels: - defaults dependencies: @@ -7,4 +7,4 @@ dependencies: - pip - pip: - "git+git://github.com/arviz-devs/arviz.git@master" - - "git+git://github.com/pymc-devs/pymc3.git@main" + - "git+git://github.com/pymc-devs/pymc.git@main" diff --git a/Rethinking/Chp_02.ipynb b/Rethinking/Chp_02.ipynb index ac77cbc..18dca47 100644 --- a/Rethinking/Chp_02.ipynb +++ b/Rethinking/Chp_02.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats" ] }, @@ -179,8 +179,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.\n", - " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.\n", + " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.')\n", "logp = -1.8075, ||grad|| = 1.5: 100%|██████████| 7/7 [00:00<00:00, 1327.37it/s]\n" ] }, @@ -286,7 +286,7 @@ "This notebook was created using:\n", "Python 3.7.1\n", "IPython 6.2.1\n", - "PyMC3 3.7.rc1\n", + "PyMC 3.7.rc1\n", "ArviZ 0.4.0\n", "NumPy 1.15.4\n", "SciPy 1.1.0\n", @@ -303,7 +303,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_03.ipynb b/Rethinking/Chp_03.ipynb index fdc34f2..0f0ce9d 100644 --- a/Rethinking/Chp_03.ipynb +++ b/Rethinking/Chp_03.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats" ] }, @@ -897,7 +897,7 @@ "This notebook was created using:\n", "Python 3.7.2\n", "IPython 7.9.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "ArviZ 0.5.1\n", "NumPy 1.17.3\n", "SciPy 1.3.1\n", @@ -914,7 +914,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_04.ipynb b/Rethinking/Chp_04.ipynb index 134922f..1a131df 100644 --- a/Rethinking/Chp_04.ipynb +++ b/Rethinking/Chp_04.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats\n", "\n", "from scipy.interpolate import griddata" @@ -753,11 +753,11 @@ "source": [ "#### Code 4.26\n", "\n", - "We could use a quadratic approximation like McElreath does in his book and we did in code 2.6. But Using PyMC3 is really simple to just sample from the model using a \"sampler method\". Most common sampler methods are members of the Markov Chain Monte Carlo Method (MCMC) family (for details read Section 2.4.3 and Chapter 8 of Statistical Rethinking).\n", + "We could use a quadratic approximation like McElreath does in his book and we did in code 2.6. But Using PyMC is really simple to just sample from the model using a \"sampler method\". Most common sampler methods are members of the Markov Chain Monte Carlo Method (MCMC) family (for details read Section 2.4.3 and Chapter 8 of Statistical Rethinking).\n", "\n", - "PyMC3 comes with various samplers. Some samplers are more suited than others for certain type of variable (and/or problems). For now we are going to let PyMC3 choose the sampler for us. PyMC3 also tries to provide a reasonable starting point for the simulation. By default PyMC3 uses the same adaptive procedure as in STAN `'jitter+adapt_diag'`, which start with a identity mass matrix and then adapt a diagonal based on the variance of the tuning samples. \n", + "PyMC comes with various samplers. Some samplers are more suited than others for certain type of variable (and/or problems). For now we are going to let PyMC choose the sampler for us. PyMC also tries to provide a reasonable starting point for the simulation. By default PyMC uses the same adaptive procedure as in STAN `'jitter+adapt_diag'`, which start with a identity mass matrix and then adapt a diagonal based on the variance of the tuning samples. \n", "\n", - "You can read more details of PyMC3 [here](http://pymc-devs.github.io/pymc3/notebooks/getting_started.html)" + "You can read more details of PyMC [here](http://pymc-devs.github.io/pymc/notebooks/getting_started.html)" ] }, { @@ -1941,7 +1941,7 @@ "\n", " height = pm.Normal('height', mu=alpha + beta * d2.weight, sd=sigma, observed=d2.height)\n", " \n", - "Using PyMC3 there is not too much reason to do this. I personally think that defining mu in a separate line improves readability." + "Using PyMC there is not too much reason to do this. I personally think that defining mu in a separate line improves readability." ] }, { @@ -2697,7 +2697,7 @@ "source": [ "#### Code 4.53\n", "\n", - "Using PyMC3, we do not need to compute anything else. By defining a deterministic variable mu in the model, we add that variable to the trace. Thus we get a matrix with row samples from the posterior and columns values of weights. We can access this matrix directly from the trace or turn it into a DataFrame, it all depends on what we need." + "Using PyMC, we do not need to compute anything else. By defining a deterministic variable mu in the model, we add that variable to the trace. Thus we get a matrix with row samples from the posterior and columns values of weights. We can access this matrix directly from the trace or turn it into a DataFrame, it all depends on what we need." ] }, { @@ -2963,7 +2963,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/sampling.py:1296: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/sampling.py:1296: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " \"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] }, @@ -3471,7 +3471,7 @@ "text": [ "/home/osvaldo/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:2: DeprecationWarning: sample_ppc() is deprecated. Please use sample_posterior_predictive()\n", " \n", - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/sampling.py:1296: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/sampling.py:1296: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " \"samples parameter is smaller than nchains times ndraws, some draws \"\n" ] }, @@ -3701,7 +3701,7 @@ "This notebook was created using:\n", "Python 3.7.3\n", "IPython 7.11.1\n", - "PyMC3 3.8\n", + "PyMC 3.8\n", "ArviZ 0.6.1\n", "NumPy 1.17.4\n", "SciPy 1.4.1\n", @@ -3718,7 +3718,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_05.ipynb b/Rethinking/Chp_05.ipynb index d4a0939..4b45a9a 100644 --- a/Rethinking/Chp_05.ipynb +++ b/Rethinking/Chp_05.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "import statsmodels.formula.api as smf\n", "\n", @@ -3995,7 +3995,7 @@ " $$" ], "text/plain": [ - "" + "" ] }, "execution_count": 77, @@ -4020,7 +4020,7 @@ "This notebook was created using:\n", "Python 3.7.1\n", "IPython 6.2.1\n", - "PyMC3 3.7.rc1\n", + "PyMC 3.7.rc1\n", "ArviZ 0.4.0\n", "NumPy 1.15.4\n", "SciPy 1.1.0\n", @@ -4037,7 +4037,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_06.ipynb b/Rethinking/Chp_06.ipynb index 1c0240f..376ca12 100644 --- a/Rethinking/Chp_06.ipynb +++ b/Rethinking/Chp_06.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import statsmodels.api as sm\n", "\n", "# R-like interface, alternatively you can import statsmodels as import statsmodels.api as sm\n", @@ -481,7 +481,7 @@ " \n", " np.concatenate([mm_train, x_train[:, 1:k]], axis=1)\n", " \n", - " #Using pymc3\n", + " #Using pymc\n", " \n", " with pm.Model() as m_sim:\n", " vec_V = pm.MvNormal('vec_V', mu=0, cov=b_sigma * np.eye(n_dim), \n", @@ -1206,7 +1206,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1250,12 +1250,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1701,7 +1701,7 @@ "This notebook was created using:\n", "Python 3.7.1\n", "IPython 6.2.1\n", - "PyMC3 3.7.rc1\n", + "PyMC 3.7.rc1\n", "ArviZ 0.4.0\n", "NumPy 1.15.4\n", "SciPy 1.1.0\n", @@ -1718,7 +1718,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_07.ipynb b/Rethinking/Chp_07.ipynb index a744ea6..f9d0c51 100644 --- a/Rethinking/Chp_07.ipynb +++ b/Rethinking/Chp_07.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import statsmodels.formula.api as smf\n", "\n", "from scipy import stats\n", @@ -313,7 +313,7 @@ "source": [ "#### Code 7.5\n", "\n", - "WAIC values are point estimates and hence is a good idea to include the uncertainty asociated with their estimation when computing weights. PyMC3 uses a Bayesian bootstrapping to do this (read more [here](https://arxiv.org/abs/1704.02030)), and also to compute the standard error (SE) of WAIC/LOO estimates. If you set `bootstrapping = False` weights (and SE) will be computed as in the book." + "WAIC values are point estimates and hence is a good idea to include the uncertainty asociated with their estimation when computing weights. PyMC uses a Bayesian bootstrapping to do this (read more [here](https://arxiv.org/abs/1704.02030)), and also to compute the standard error (SE) of WAIC/LOO estimates. If you set `bootstrapping = False` weights (and SE) will be computed as in the book." ] }, { @@ -325,7 +325,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -578,12 +578,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:993: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1491,8 +1491,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.\n", - " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.\n", + " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.')\n", "logp = -175.26, ||grad|| = 0.0011502: 100%|██████████| 24/24 [00:00<00:00, 1082.61it/s] \n" ] }, @@ -1532,8 +1532,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.\n", - " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.\n", + " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.')\n", "logp = -170.17, ||grad|| = 0.012971: 100%|██████████| 54/54 [00:00<00:00, 1531.53it/s] \n" ] }, @@ -1584,8 +1584,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.\n", - " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.\n", + " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.')\n", " 0%| | 0/5000 [00:00" + "" ] }, "execution_count": 39, @@ -2788,8 +2788,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.\n", - " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')\n" + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.\n", + " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.')\n" ] }, { @@ -3584,27 +3584,27 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/home/osvaldo/proyectos/00_PyMC3/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/home/osvaldo/proyectos/00_PyMC/arviz/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -4947,7 +4947,7 @@ "This notebook was created using:\n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "ArviZ 0.4.1\n", "NumPy 1.16.4\n", "SciPy 1.2.1\n", @@ -4964,7 +4964,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_11.ipynb b/Rethinking/Chp_11.ipynb index 425ad53..4a8e680 100644 --- a/Rethinking/Chp_11.ipynb +++ b/Rethinking/Chp_11.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "\n", "from theano import shared" @@ -358,8 +358,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.\n", - " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')\n" + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.\n", + " warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc.sample() and it will automatically initialize NUTS in a better way.')\n" ] }, { @@ -1261,7 +1261,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"This notebook was createad on a computer {} running {} and using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nNumPy {}\\nPandas {}\\nSciPy {}\\nMatplotlib {}\\n\".format(platform.machine(), ' '.join(platform.linux_distribution()[:2]), sys.version[:5], IPython.__version__, pm.__version__, np.__version__, pd.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"This notebook was createad on a computer {} running {} and using:\\nPython {}\\nIPython {}\\nPyMC {}\\nNumPy {}\\nPandas {}\\nSciPy {}\\nMatplotlib {}\\n\".format(platform.machine(), ' '.join(platform.linux_distribution()[:2]), sys.version[:5], IPython.__version__, pm.__version__, np.__version__, pd.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_12.ipynb b/Rethinking/Chp_12.ipynb index dc49cae..057f147 100644 --- a/Rethinking/Chp_12.ipynb +++ b/Rethinking/Chp_12.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy import stats\n", "from scipy.special import expit as logistic" @@ -253,7 +253,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -349,7 +349,7 @@ "metadata": {}, "outputs": [], "source": [ - "# extract PyMC3 samples\n", + "# extract PyMC samples\n", "post = pm.trace_to_dataframe(trace_12_2, varnames=['a_tank'])\n", "\n", "# compute median intercept for each tank\n", @@ -839,7 +839,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This part is more Stan and rethinking related. To do the same in PyMC3 (i.e., avoid compiling the same model twice), you need to set up the input data with `theano.shared` or use [sampled](https://github.com/ColCarroll/sampled), a functional decorator for PyMC3." + "This part is more Stan and rethinking related. To do the same in PyMC (i.e., avoid compiling the same model twice), you need to set up the input data with `theano.shared` or use [sampled](https://github.com/ColCarroll/sampled), a functional decorator for PyMC." ] }, { @@ -2246,7 +2246,7 @@ "This notebook was created using:\n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "ArviZ 0.4.1\n", "NumPy 1.16.3\n", "SciPy 1.2.1\n", @@ -2262,15 +2262,15 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking/Chp_13.ipynb b/Rethinking/Chp_13.ipynb index aa1416c..7a3fe69 100644 --- a/Rethinking/Chp_13.ipynb +++ b/Rethinking/Chp_13.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from theano import tensor as tt" ] @@ -2906,7 +2906,7 @@ "This notebook was created using:\n", "Python 3.7.2\n", "IPython 7.6.1\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "ArviZ 0.4.1\n", "NumPy 1.16.0\n", "SciPy 1.2.0\n", @@ -2922,7 +2922,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nSciPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, scipy.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/Chp_14.ipynb b/Rethinking/Chp_14.ipynb index d058255..816d701 100644 --- a/Rethinking/Chp_14.ipynb +++ b/Rethinking/Chp_14.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm" + "import pymc as pm" ] }, { @@ -1239,7 +1239,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -1282,7 +1282,7 @@ "# prep data\n", "kcal = d['kcal.per.g'].values.copy()\n", "logmass = d['logmass'].values.copy()\n", - "# PyMC3 can handle missing value quite naturally.\n", + "# PyMC can handle missing value quite naturally.\n", "neocortex = d['neocortex.prop'].values.copy()\n", "mask = np.isfinite(neocortex)\n", "neocortex[~mask] = -999\n", @@ -1653,7 +1653,7 @@ } ], "source": [ - "# the missing value in pymc3 is automatically model as a node with *_missing as name\n", + "# the missing value in pymc is automatically model as a node with *_missing as name\n", "az.summary(trace_14_3, var_names=['neocortex_missing', \n", " 'a', 'bN', 'bM', 'nu', 'sigma_N', 'sigma'],\n", " round_to=2)" @@ -1862,7 +1862,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/osvaldo/proyectos/00_PyMC3/pymc3/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/home/osvaldo/proyectos/00_PyMC/pymc/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -2287,7 +2287,7 @@ "metadata": {}, "source": [ "#### Code 14.11-14\n", - "Stan related. As you can see above, PyMC3 deal with missing value internally if you represent the observed data using a numpy mask array. The missing/masked value are replaced with a new random variable added to the model (with name `*_missing`)." + "Stan related. As you can see above, PyMC deal with missing value internally if you represent the observed data using a numpy mask array. The missing/masked value are replaced with a new random variable added to the model (with name `*_missing`)." ] }, { @@ -2302,7 +2302,7 @@ "This notebook was created using:\n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "ArviZ 0.4.1\n", "NumPy 1.16.4\n", "Matplotlib 3.1.0\n", @@ -2317,7 +2317,7 @@ "import matplotlib\n", "import scipy\n", "\n", - "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC3 {}\\nArviZ {}\\nNumPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, matplotlib.__version__))" + "print(\"\"\"This notebook was created using:\\nPython {}\\nIPython {}\\nPyMC {}\\nArviZ {}\\nNumPy {}\\nMatplotlib {}\\n\"\"\".format(sys.version[:5], IPython.__version__, pm.__version__, az.__version__, np.__version__, matplotlib.__version__))" ] } ], diff --git a/Rethinking/README.md b/Rethinking/README.md index 2bdb9e5..c62247b 100644 --- a/Rethinking/README.md +++ b/Rethinking/README.md @@ -1,8 +1,8 @@ -# Statistical Rethinking with Python and PyMC3 +# Statistical Rethinking with Python and PyMC [Statistical Rethinking](http://xcelab.net/rm/statistical-rethinking/) is an incredible introductory book to Bayesian Statistics. It follows a [_Jaynesian_](https://en.wikipedia.org/wiki/Edwin_Thompson_Jaynes) and practical approach with very good examples and clear explanations. -In this repository we port [the book's original code in R and Stan](https://github.com/rmcelreath/rethinking) to Python and PyMC3. We attempt to reproduce the examples as faithfully as possible while expressing them in a _Pythonic_ and _PyMC3onic_ way. +In this repository we port [the book's original code in R and Stan](https://github.com/rmcelreath/rethinking) to Python and PyMC. We attempt to reproduce the examples as faithfully as possible while expressing them in a _Pythonic_ and _PyMConic_ way. ## Display notebooks [![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/pymc-devs/resources/master?filepath=Rethinking) @@ -14,7 +14,7 @@ All contributions are welcome! Feel free to send PR to fix errors, improve the code, or make comments that could help users of this repository and readers of the book. -You can also join the discussion on [Gitter](https://gitter.im/Statistical-Rethinking-with-Python-and-PyMC3/Lobby). +You can also join the discussion on [Gitter](https://gitter.im/Statistical-Rethinking-with-Python-and-PyMC/Lobby). ## Installing the dependencies @@ -26,8 +26,8 @@ to install all the dependencies into an isolated environment. Activate the environment by running: - source activate stat-rethink-pymc3 + source activate stat-rethink-pymc --- -Creative Commons License
Statistical Rethinking with Python and PyMC3 by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. +Creative Commons License
Statistical Rethinking with Python and PyMC by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/Rethinking/end-of-chapter-practice-problems/ch-10.ipynb b/Rethinking/end-of-chapter-practice-problems/ch-10.ipynb index 06fdde5..c6ba00e 100644 --- a/Rethinking/end-of-chapter-practice-problems/ch-10.ipynb +++ b/Rethinking/end-of-chapter-practice-problems/ch-10.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "import seaborn as sns\n", "\n", @@ -261,7 +261,7 @@ "\n", "*Can you explain both the differences and the similarities between the approximate and the MCMC distributions?*\n", "\n", - "Related to R and map. See code 10.14 in chapter 10 notebook for model specification and MCMC estimation in PyMC3" + "Related to R and map. See code 10.14 in chapter 10 notebook for model specification and MCMC estimation in PyMC" ] }, { @@ -542,13 +542,13 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " return np.stack(logp)\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " return np.stack(logp)\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " return np.stack(logp)\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " return np.stack(logp)\n" ] }, @@ -994,7 +994,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/io_pymc3.py:56: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/io_pymc3.py:56: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " chain_likelihoods.append(np.stack(log_like))\n" ] }, @@ -1647,16 +1647,16 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " return np.stack(logp)\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:168: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n", " return np.stack(logp)\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -2410,7 +2410,7 @@ "This notebook was created on a computer x86_64, using: \n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "NumPy 1.16.3\n", "Pandas 0.24.2\n", "SciPy 1.2.1\n", @@ -2428,7 +2428,7 @@ "import scipy\n", "\n", "print(f\"This notebook was created on a computer {platform.machine()}, using: \"\n", - " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC3 {pm.__version__}\\nNumPy {np.__version__}\"\n", + " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC {pm.__version__}\\nNumPy {np.__version__}\"\n", " f\"\\nPandas {pd.__version__}\\nSciPy {scipy.__version__}\\nMatplotlib {matplotlib.__version__}\\n\")" ] }, @@ -2442,9 +2442,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking/end-of-chapter-practice-problems/ch-11.ipynb b/Rethinking/end-of-chapter-practice-problems/ch-11.ipynb index b5c5883..dfc0dcb 100644 --- a/Rethinking/end-of-chapter-practice-problems/ch-11.ipynb +++ b/Rethinking/end-of-chapter-practice-problems/ch-11.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "import seaborn as sns\n", "\n", @@ -655,12 +655,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1097,12 +1097,12 @@ "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [bp, bf, a]\n", "Sampling 2 chains: 100%|██████████| 6000/6000 [00:18<00:00, 326.81draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1442,12 +1442,12 @@ "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [bd, bf, a]\n", "Sampling 2 chains: 100%|██████████| 6000/6000 [00:09<00:00, 529.37draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1769,22 +1769,22 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -2177,22 +2177,22 @@ "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [bd, bf, a]\n", "Sampling 2 chains: 100%|██████████| 6000/6000 [00:10<00:00, 575.35draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -2973,12 +2973,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -3383,7 +3383,7 @@ "This notebook was created on a computer x86_64, using: \n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "Arviz 0.4.1\n", "NumPy 1.16.3\n", "Pandas 0.24.2\n", @@ -3402,7 +3402,7 @@ "import scipy\n", "\n", "print(f\"This notebook was created on a computer {platform.machine()}, using: \"\n", - " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC3 {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", + " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", " f\"\\nPandas {pd.__version__}\\nSciPy {scipy.__version__}\\nMatplotlib {matplotlib.__version__}\\n\")" ] }, @@ -3416,9 +3416,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking/end-of-chapter-practice-problems/ch-12.ipynb b/Rethinking/end-of-chapter-practice-problems/ch-12.ipynb index abe960a..cbc0c00 100644 --- a/Rethinking/end-of-chapter-practice-problems/ch-12.ipynb +++ b/Rethinking/end-of-chapter-practice-problems/ch-12.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "import seaborn as sns\n", "\n", @@ -614,27 +614,27 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -2218,7 +2218,7 @@ "This notebook was created on a computer x86_64, using: \n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "Arviz 0.4.1\n", "NumPy 1.16.3\n", "Pandas 0.24.2\n", @@ -2237,7 +2237,7 @@ "import scipy\n", "\n", "print(f\"This notebook was created on a computer {platform.machine()}, using: \"\n", - " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC3 {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", + " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", " f\"\\nPandas {pd.__version__}\\nSciPy {scipy.__version__}\\nMatplotlib {matplotlib.__version__}\\n\")" ] }, @@ -2251,9 +2251,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking/end-of-chapter-practice-problems/ch-13.ipynb b/Rethinking/end-of-chapter-practice-problems/ch-13.ipynb index 62bc956..6afc81b 100644 --- a/Rethinking/end-of-chapter-practice-problems/ch-13.ipynb +++ b/Rethinking/end-of-chapter-practice-problems/ch-13.ipynb @@ -14,7 +14,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "import seaborn as sns\n", "\n", @@ -292,7 +292,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1954,32 +1954,32 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -3383,7 +3383,7 @@ "This notebook was created on a computer x86_64, using: \n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "Arviz 0.4.1\n", "NumPy 1.16.3\n", "Pandas 0.24.2\n", @@ -3402,7 +3402,7 @@ "import scipy\n", "\n", "print(f\"This notebook was created on a computer {platform.machine()}, using: \"\n", - " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC3 {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", + " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", " f\"\\nPandas {pd.__version__}\\nSciPy {scipy.__version__}\\nMatplotlib {matplotlib.__version__}\\n\")" ] }, @@ -3416,9 +3416,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking/end-of-chapter-practice-problems/ch-14.ipynb b/Rethinking/end-of-chapter-practice-problems/ch-14.ipynb index c7e35ba..4dd2cef 100644 --- a/Rethinking/end-of-chapter-practice-problems/ch-14.ipynb +++ b/Rethinking/end-of-chapter-practice-problems/ch-14.ipynb @@ -14,7 +14,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "import seaborn as sns\n", "\n", @@ -384,12 +384,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\"\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1078: UserWarning: For one or more samples the posterior variance of the log predictive\n", " densities exceeds 0.4. This could be indication of WAIC starting to fail see\n", " http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -678,28 +678,28 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [neocortex_missing, sigma_N, mu_N, sigma, a]\n", "Sampling 2 chains: 100%|██████████| 4000/4000 [00:10<00:00, 366.52draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [neocortex_missing, sigma_N, mu_N, sigma, bn, a]\n", "Sampling 2 chains: 100%|██████████| 6000/6000 [01:24<00:00, 71.15draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [neocortex_missing, sigma_N, mu_N, sigma, bm, a]\n", "Sampling 2 chains: 100%|██████████| 4000/4000 [00:12<00:00, 326.81draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -803,22 +803,22 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -1294,28 +1294,28 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [neocortex_missing, sigma, a]\n", "Sampling 2 chains: 100%|██████████| 4000/4000 [00:16<00:00, 241.38draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [neocortex_missing, sigma_N, gm, an, sigma, bn, a]\n", "Sampling 2 chains: 100%|██████████| 6000/6000 [01:31<00:00, 36.16draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [neocortex_missing, sigma, bm, a]\n", "Sampling 2 chains: 100%|██████████| 4000/4000 [00:15<00:00, 265.01draws/s]\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in neocortex contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -1419,32 +1419,32 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", " \"\"\")\n", - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/stats.py:219: UserWarning: For one or more samples the posterior variance of the\n", " log predictive densities exceeds 0.4. This could be indication of\n", " WAIC starting to fail see http://arxiv.org/abs/1507.04544 for details\n", " \n", @@ -3799,7 +3799,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/anaconda/envs/stat-rethink-pymc3/lib/python3.7/site-packages/pymc3/model.py:1331: UserWarning: Data in x_est contains missing values and will be automatically imputed from the sampling distribution.\n", + "/anaconda/envs/stat-rethink-pymc/lib/python3.7/site-packages/pymc/model.py:1331: UserWarning: Data in x_est contains missing values and will be automatically imputed from the sampling distribution.\n", " warnings.warn(impute_message, UserWarning)\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -4147,7 +4147,7 @@ "This notebook was created on a computer x86_64, using: \n", "Python 3.7.3\n", "IPython 7.5.0\n", - "PyMC3 3.7\n", + "PyMC 3.7\n", "Arviz 0.4.1\n", "NumPy 1.16.3\n", "Pandas 0.24.2\n", @@ -4167,7 +4167,7 @@ "\n", "print(\n", " f\"This notebook was created on a computer {platform.machine()}, using: \"\n", - " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC3 {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", + " f\"\\nPython {sys.version[:5]}\\nIPython {IPython.__version__}\\nPyMC {pm.__version__}\\nArviz {az.__version__}\\nNumPy {np.__version__}\"\n", " f\"\\nPandas {pd.__version__}\\nSciPy {scipy.__version__}\\nMatplotlib {matplotlib.__version__}\\n\"\n", ")" ] @@ -4182,9 +4182,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking/end-of-chapter-practice-problems/ch-2.ipynb b/Rethinking/end-of-chapter-practice-problems/ch-2.ipynb index 3aedb2f..faf3645 100644 --- a/Rethinking/end-of-chapter-practice-problems/ch-2.ipynb +++ b/Rethinking/end-of-chapter-practice-problems/ch-2.ipynb @@ -26,7 +26,7 @@ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats\n", "\n", "%config InlineBackend.figure_format = 'retina'\n", diff --git a/Rethinking/environment.yml b/Rethinking/environment.yml index f8caf77..b63599b 100644 --- a/Rethinking/environment.yml +++ b/Rethinking/environment.yml @@ -1,4 +1,4 @@ -name: stat-rethink-pymc3 +name: stat-rethink-pymc channels: - defaults dependencies: @@ -9,4 +9,4 @@ dependencies: - pip - pip: - "git+git://github.com/arviz-devs/arviz.git@main" - - "git+git://github.com/pymc-devs/pymc3.git@main" + - "git+git://github.com/pymc-devs/pymc.git@main" diff --git a/Rethinking_2/Chp_02.ipynb b/Rethinking_2/Chp_02.ipynb index 0a87846..e58a687 100644 --- a/Rethinking_2/Chp_02.ipynb +++ b/Rethinking_2/Chp_02.ipynb @@ -9,7 +9,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats" ] }, @@ -435,7 +435,7 @@ "IPython version : 7.19.0\n", "\n", "arviz : 0.10.0\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "numpy : 1.19.4\n", "matplotlib: 3.3.3\n", "scipy : 1.5.4\n", diff --git a/Rethinking_2/Chp_03.ipynb b/Rethinking_2/Chp_03.ipynb index e82d7dd..24cd90f 100644 --- a/Rethinking_2/Chp_03.ipynb +++ b/Rethinking_2/Chp_03.ipynb @@ -17,7 +17,7 @@ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats" ] }, @@ -739,11 +739,11 @@ "Python version : 3.9.7\n", "IPython version : 8.1.1\n", "\n", - "matplotlib: 3.5.1\n", - "numpy : 1.21.5\n", - "pymc3 : 3.11.4\n", - "scipy : 1.7.3\n", - "arviz : 0.11.2\n", + "arviz : 0.10.0\n", + "scipy : 1.5.4\n", + "matplotlib: 3.3.3\n", + "pymc : 3.9.3\n", + "numpy : 1.19.4\n", "\n", "Watermark: 2.3.0\n", "\n" diff --git a/Rethinking_2/Chp_04.ipynb b/Rethinking_2/Chp_04.ipynb index 9b015ff..db23321 100644 --- a/Rethinking_2/Chp_04.ipynb +++ b/Rethinking_2/Chp_04.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy.stats as stats\n", "import seaborn as sns\n", "\n", @@ -86,17 +86,17 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).\n", " warnings.warn(msg, FutureWarning)\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/seaborn/distributions.py:1657: FutureWarning: The `bw` parameter is deprecated in favor of `bw_method` and `bw_adjust`. Using 0.01 for `bw_method`, but please see the docs for the new parameters and update your code.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/seaborn/distributions.py:1657: FutureWarning: The `bw` parameter is deprecated in favor of `bw_method` and `bw_adjust`. Using 0.01 for `bw_method`, but please see the docs for the new parameters and update your code.\n", " warnings.warn(msg, FutureWarning)\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).\n", " warnings.warn(msg, FutureWarning)\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/seaborn/distributions.py:1657: FutureWarning: The `bw` parameter is deprecated in favor of `bw_method` and `bw_adjust`. Using 0.01 for `bw_method`, but please see the docs for the new parameters and update your code.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/seaborn/distributions.py:1657: FutureWarning: The `bw` parameter is deprecated in favor of `bw_method` and `bw_adjust`. Using 0.01 for `bw_method`, but please see the docs for the new parameters and update your code.\n", " warnings.warn(msg, FutureWarning)\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).\n", " warnings.warn(msg, FutureWarning)\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/seaborn/distributions.py:1657: FutureWarning: The `bw` parameter is deprecated in favor of `bw_method` and `bw_adjust`. Using 0.01 for `bw_method`, but please see the docs for the new parameters and update your code.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/seaborn/distributions.py:1657: FutureWarning: The `bw` parameter is deprecated in favor of `bw_method` and `bw_adjust`. Using 0.01 for `bw_method`, but please see the docs for the new parameters and update your code.\n", " warnings.warn(msg, FutureWarning)\n" ] }, @@ -1037,11 +1037,11 @@ "source": [ "#### Code 4.28\n", "\n", - "We could use a quadratic approximation like McElreath does in his book and we did in code 2.6. But Using PyMC3 is really simple to just sample from the model using a \"sampler method\". Most common sampler methods are members of the Markov Chain Monte Carlo Method (MCMC) family (for details read Section 2.4.3 and Chapter 8 of Statistical Rethinking).\n", + "We could use a quadratic approximation like McElreath does in his book and we did in code 2.6. But Using PyMC is really simple to just sample from the model using a \"sampler method\". Most common sampler methods are members of the Markov Chain Monte Carlo Method (MCMC) family (for details read Section 2.4.3 and Chapter 8 of Statistical Rethinking).\n", "\n", - "PyMC3 comes with various samplers. Some samplers are more suited than others for certain type of variable (and/or problems). For now we are going to let PyMC3 choose the sampler for us. PyMC3 also tries to provide a reasonable starting point for the simulation. By default PyMC3 uses the same adaptive procedure as in STAN `'jitter+adapt_diag'`, which starts with a identity mass matrix and then adapts a diagonal based on the variance of the tuning samples. \n", + "PyMC comes with various samplers. Some samplers are more suited than others for certain type of variable (and/or problems). For now we are going to let PyMC choose the sampler for us. PyMC also tries to provide a reasonable starting point for the simulation. By default PyMC uses the same adaptive procedure as in STAN `'jitter+adapt_diag'`, which starts with a identity mass matrix and then adapts a diagonal based on the variance of the tuning samples. \n", "\n", - "You can read more details of PyMC3 [here](http://pymc-devs.github.io/pymc3/notebooks/getting_started.html)" + "You can read more details of PyMC [here](http://pymc-devs.github.io/pymc/notebooks/getting_started.html)" ] }, { @@ -1053,7 +1053,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -1112,7 +1112,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -1166,7 +1166,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -1247,7 +1247,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -1316,7 +1316,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -1358,7 +1358,7 @@ "output_type": "stream", "text": [ "Sampling 4 chains for 1_000 tune and 1_000 draw iterations (4_000 + 4_000 draws total) took 8 seconds.\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -1718,7 +1718,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -1939,7 +1939,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -2003,7 +2003,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -2074,7 +2074,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -2367,7 +2367,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -2652,7 +2652,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] } @@ -2717,7 +2717,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:1688: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:1688: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -2771,7 +2771,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] } @@ -2796,7 +2796,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -2868,9 +2868,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -3015,7 +3015,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -3083,7 +3083,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -3124,7 +3124,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:96: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -3221,7 +3221,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:1688: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:1688: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -3276,9 +3276,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -3341,7 +3341,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -3413,7 +3413,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:1688: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:1688: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -3450,9 +3450,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -3683,7 +3683,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/pymc3/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/pymc/sampling.py:466: FutureWarning: In an upcoming release, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.\n", " warnings.warn(\n", "Auto-assigning NUTS sampler...\n", "Initializing NUTS using jitter+adapt_diag...\n", @@ -3794,7 +3794,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/damian/miniconda3/envs/stat-rethink2-pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/damian/miniconda3/envs/stat-rethink2-pymc/lib/python3.8/site-packages/arviz/stats/stats.py:456: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -3850,7 +3850,7 @@ "\n", "seaborn : 0.11.1\n", "numpy : 1.19.2\n", - "pymc3 : 3.11.1\n", + "pymc : 3.11.1\n", "scipy : 1.6.0\n", "arviz : 0.11.1\n", "matplotlib: 3.3.4\n", diff --git a/Rethinking_2/Chp_05.ipynb b/Rethinking_2/Chp_05.ipynb index 926bc2f..5b40eac 100644 --- a/Rethinking_2/Chp_05.ipynb +++ b/Rethinking_2/Chp_05.ipynb @@ -21,7 +21,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from causalgraphicalmodels import CausalGraphicalModel\n", "from scipy import stats\n", @@ -867,7 +867,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/joanna/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc3/sampling.py:1690: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/joanna/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc/sampling.py:1690: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -881,7 +881,7 @@ } ], "source": [ - "# We can skip most of the code with the posterior predictive plot functionality in pymc3\n", + "# We can skip most of the code with the posterior predictive plot functionality in pymc\n", "with m_5_3:\n", " m_5_3_ppc = pm.sample_posterior_predictive(\n", " m_5_3_trace, var_names=[\"mu\", \"divorce_rate_std\"], samples=1000\n", @@ -1087,7 +1087,7 @@ } ], "source": [ - "# With PyMC3 we have to simulate in each model separately\n", + "# With PyMC we have to simulate in each model separately\n", "\n", "# Simulate the marriage rates at each age first\n", "age_shared.set_value(A_seq)\n", @@ -1264,7 +1264,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/joanna/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc3/sampling.py:1690: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/joanna/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc/sampling.py:1690: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -1431,8 +1431,8 @@ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mSamplingError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mK\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mNormal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"K\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmu\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msigma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobserved\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0md\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"K\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mm5_5_draft_trace\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc3/sampling.py\u001b[0m in \u001b[0;36msample\u001b[0;34m(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, callback, jitter_max_retries, return_inferencedata, idata_kwargs, mp_ctx, pickle_backend, **kwargs)\u001b[0m\n\u001b[1;32m 425\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodelcontext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 426\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstart\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 427\u001b[0;31m \u001b[0mcheck_start_vals\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtest_point\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 428\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 429\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc3/util.py\u001b[0m in \u001b[0;36mcheck_start_vals\u001b[0;34m(start, model)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 228\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mall\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misfinite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minitial_eval\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 229\u001b[0;31m raise SamplingError(\n\u001b[0m\u001b[1;32m 230\u001b[0m \u001b[0;34m\"Initial evaluation of model at starting point failed!\\n\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0;34m\"Starting values:\\n{}\\n\\n\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc/sampling.py\u001b[0m in \u001b[0;36msample\u001b[0;34m(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, callback, jitter_max_retries, return_inferencedata, idata_kwargs, mp_ctx, pickle_backend, **kwargs)\u001b[0m\n\u001b[1;32m 425\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodelcontext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 426\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstart\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 427\u001b[0;31m \u001b[0mcheck_start_vals\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtest_point\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 428\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 429\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc/util.py\u001b[0m in \u001b[0;36mcheck_start_vals\u001b[0;34m(start, model)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 228\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mall\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misfinite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minitial_eval\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 229\u001b[0;31m raise SamplingError(\n\u001b[0m\u001b[1;32m 230\u001b[0m \u001b[0;34m\"Initial evaluation of model at starting point failed!\\n\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0;34m\"Starting values:\\n{}\\n\\n\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mSamplingError\u001b[0m: Initial evaluation of model at starting point failed!\nStarting values:\n{'sigma_log__': array(-0.36651292), 'bN': array(0.), 'a': array(0.)}\n\nInitial evaluation results:\nsigma_log__ -1.06\nbN -0.92\na -0.92\nK NaN\nName: Log-probability of test_point, dtype: float64" ] } @@ -1882,7 +1882,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/joanna/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc3/sampling.py:1690: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/joanna/Dropbox/Sketchbook/python/resources/env/lib/python3.8/site-packages/pymc/sampling.py:1690: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -2133,7 +2133,7 @@ } ], "source": [ - "# With PyMC3 it's easier just to create a deterministic that includes both values\n", + "# With PyMC it's easier just to create a deterministic that includes both values\n", "sex = d[\"male\"].values\n", "\n", "with pm.Model() as m5_8:\n", @@ -2330,7 +2330,7 @@ "\n", "pandas : 1.2.0\n", "scipy : 1.6.0\n", - "pymc3 : 3.10.0\n", + "pymc : 3.10.0\n", "sys : 3.8.5 (default, Sep 4 2020, 07:30:14) \n", "[GCC 7.3.0]\n", "numpy : 1.19.4\n", diff --git a/Rethinking_2/Chp_06.ipynb b/Rethinking_2/Chp_06.ipynb index 01e7326..4d77079 100644 --- a/Rethinking_2/Chp_06.ipynb +++ b/Rethinking_2/Chp_06.ipynb @@ -19,7 +19,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from scipy import stats\n", @@ -3027,7 +3027,7 @@ "arviz 0.7.0\n", "pandas 1.0.3\n", "daft 0.1.0\n", - "pymc3 3.8\n", + "pymc 3.8\n", "last updated: Sun May 10 2020 \n", "\n", "CPython 3.7.6\n", diff --git a/Rethinking_2/Chp_07.ipynb b/Rethinking_2/Chp_07.ipynb index f13f8da..6c4850c 100644 --- a/Rethinking_2/Chp_07.ipynb +++ b/Rethinking_2/Chp_07.ipynb @@ -17,7 +17,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import statsmodels.api as sm\n", "import statsmodels.formula.api as smf\n", "\n", @@ -741,7 +741,7 @@ "source": [ "# Figure 7.4\n", "\n", - "# this code taken from PyMC3 port of Rethinking/Chp_06.ipynb\n", + "# this code taken from PyMC port of Rethinking/Chp_06.ipynb\n", "\n", "f, (ax1, ax2) = plt.subplots(1, 2, sharey=True, figsize=(8, 3))\n", "ax1.scatter(brains.mass, brains.brain, alpha=0.8)\n", @@ -879,7 +879,7 @@ } ], "source": [ - "# PyMC3 does not have a way to calculate LPPD directly, so we use the approach from 7.14\n", + "# PyMC does not have a way to calculate LPPD directly, so we use the approach from 7.14\n", "\n", "sigmas = (np.sum((pred - brains.brain_std.values.reshape(-1, 1)) ** 2, 0) / 7) ** 0.5\n", "ll = np.zeros((n, ns))\n", @@ -990,7 +990,7 @@ "\n", " np.concatenate([mm_train, x_train[:, 1:k]], axis=1)\n", "\n", - " # Using pymc3\n", + " # Using pymc\n", "\n", " with pm.Model() as m_sim:\n", " vec_V = pm.MvNormal(\n", @@ -3119,7 +3119,7 @@ "source": [ "#### Code 7.17\n", "\n", - "Does not apply because multi-threading is automatic in PyMC3." + "Does not apply because multi-threading is automatic in PyMC." ] }, { @@ -3994,7 +3994,7 @@ " Parameters\n", " ----------\n", " dataset_dict : dict\n", - " A dict containing two ore more {'name': pymc3.backends.base.MultiTrace}\n", + " A dict containing two ore more {'name': pymc.backends.base.MultiTrace}\n", " items.\n", " metric : str\n", " The name of the matric to be calculated. Can be any valid column output\n", @@ -4605,7 +4605,7 @@ "text": [ "pandas 1.1.1\n", "numpy 1.19.1\n", - "pymc3 3.9.3\n", + "pymc 3.9.3\n", "arviz 0.9.0\n", "statsmodels.api 0.11.1\n", "last updated: Mon Aug 24 2020 \n", diff --git a/Rethinking_2/Chp_08.ipynb b/Rethinking_2/Chp_08.ipynb index 0f3f157..99869fa 100644 --- a/Rethinking_2/Chp_08.ipynb +++ b/Rethinking_2/Chp_08.ipynb @@ -17,7 +17,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from scipy import stats\n", @@ -1300,7 +1300,7 @@ " lw=1,\n", " edgecolor=\"k\",\n", ")\n", - "# calculating predicted manually because this is a pain with categorical variabiles in PyMC3\n", + "# calculating predicted manually because this is a pain with categorical variabiles in PyMC\n", "pred0 = m_8_3_posterior[\"a\"][:, 0] + rugged_plot.reshape(-1, 1) * m_8_3_posterior[\"b\"][:, 0]\n", "ax0.plot(rugged_plot, pred0.mean(1), color=\"grey\")\n", "az.plot_hdi(rugged_plot, pred0.T, color=\"grey\", hdi_prob=0.97, ax=ax0)\n", @@ -1312,7 +1312,7 @@ " label=\"Africa\",\n", " color=\"b\",\n", ")\n", - "# calculating predicted manually because this is a pain with categorical variabiles in PyMC3\n", + "# calculating predicted manually because this is a pain with categorical variabiles in PyMC\n", "pred1 = m_8_3_posterior[\"a\"][:, 1] + rugged_plot.reshape(-1, 1) * m_8_3_posterior[\"b\"][:, 1]\n", "ax1.plot(rugged_plot, pred1.mean(1), color=\"k\")\n", "az.plot_hdi(\n", @@ -1994,7 +1994,7 @@ "numpy 1.18.5\n", "seaborn 0.10.1\n", "arviz 0.10.0\n", - "pymc3 3.9.3\n", + "pymc 3.9.3\n", "last updated: Mon Oct 19 2020 \n", "\n", "CPython 3.8.3\n", diff --git a/Rethinking_2/Chp_09.ipynb b/Rethinking_2/Chp_09.ipynb index 7e7dc2d..08890ac 100644 --- a/Rethinking_2/Chp_09.ipynb +++ b/Rethinking_2/Chp_09.ipynb @@ -21,7 +21,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy import stats\n", "\n", @@ -456,7 +456,7 @@ "source": [ "#### Code 9.12-9.18\n", "\n", - "By using PyMC3 we are already doing everything in these code blocks (No-Uturn sampling, parallell processing).\n", + "By using PyMC we are already doing everything in these code blocks (No-Uturn sampling, parallell processing).\n", "\n", "To translate the results of `summary` to `rethinking`'s `precis`:\n", "\n", @@ -1400,7 +1400,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "pymc3 3.8\n", + "pymc 3.8\n", "numpy 1.18.1\n", "arviz 0.7.0\n", "pandas 1.0.3\n", diff --git a/Rethinking_2/Chp_11.ipynb b/Rethinking_2/Chp_11.ipynb index 1b7bfa0..4de6fd2 100644 --- a/Rethinking_2/Chp_11.ipynb +++ b/Rethinking_2/Chp_11.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano.tensor as tt\n", "\n", "from scipy import stats\n", @@ -1256,7 +1256,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (28). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (28). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -1853,8 +1853,8 @@ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0maz\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompare\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"m11_4\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mtrace_11_4\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"m11_6\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mtrace_11_6\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py\u001b[0m in \u001b[0;36mcompare\u001b[0;34m(dataset_dict, ic, method, b_samples, alpha, seed, scale)\u001b[0m\n\u001b[1;32m 240\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 241\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"bb-pseudo-bma\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 242\u001b[0;31m \u001b[0mrows\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcols\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mic_i_val\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_ic_matrix\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mics\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mic_i\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 243\u001b[0m \u001b[0mic_i_val\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mic_i_val\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mrows\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py\u001b[0m in \u001b[0;36m_ic_matrix\u001b[0;34m(ics, ic_i)\u001b[0m\n\u001b[1;32m 298\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 299\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mic\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mrows\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 300\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"The number of observations should be the same across all models\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 301\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 302\u001b[0m \u001b[0mic_i_val\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0midx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mic\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py\u001b[0m in \u001b[0;36mcompare\u001b[0;34m(dataset_dict, ic, method, b_samples, alpha, seed, scale)\u001b[0m\n\u001b[1;32m 240\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 241\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"bb-pseudo-bma\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 242\u001b[0;31m \u001b[0mrows\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcols\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mic_i_val\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_ic_matrix\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mics\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mic_i\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 243\u001b[0m \u001b[0mic_i_val\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mic_i_val\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mrows\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py\u001b[0m in \u001b[0;36m_ic_matrix\u001b[0;34m(ics, ic_i)\u001b[0m\n\u001b[1;32m 298\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 299\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mic\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mrows\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 300\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"The number of observations should be the same across all models\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 301\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 302\u001b[0m \u001b[0mic_i_val\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0midx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mic\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mValueError\u001b[0m: The number of observations should be the same across all models" ] } @@ -2366,9 +2366,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (12). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (12). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (12). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (12). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -3336,9 +3336,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", " \"Estimated shape parameter of Pareto distribution is greater than 0.7 for \"\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", " \"Estimated shape parameter of Pareto distribution is greater than 0.7 for \"\n" ] }, @@ -3431,7 +3431,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", " \"Estimated shape parameter of Pareto distribution is greater than 0.7 for \"\n" ] } @@ -3537,13 +3537,13 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -3640,7 +3640,7 @@ "metadata": {}, "source": [ "#### Code 11.49\n", - "The book doesn't pre-process the population data, but if you give them raw to PyMC3, the sampler will break: the scale of these data is too wide. However we can't just standardize the data, as we usually do. Why? Because some data points will then be negative, which doesn't play nice with the `b` exponent (try it if you don't trust me). But we'll do something similar: let's standardize the data, and then just add the absolute value of the minimum, and add yet again an epsilon -- this will ensure that our data stay positive and that the transformation will be easy to reverse when we want to plot on the natural scale:" + "The book doesn't pre-process the population data, but if you give them raw to PyMC, the sampler will break: the scale of these data is too wide. However we can't just standardize the data, as we usually do. Why? Because some data points will then be negative, which doesn't play nice with the `b` exponent (try it if you don't trust me). But we'll do something similar: let's standardize the data, and then just add the absolute value of the minimum, and add yet again an epsilon -- this will ensure that our data stay positive and that the transformation will be easy to reverse when we want to plot on the natural scale:" ] }, { @@ -3839,13 +3839,13 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -4476,7 +4476,7 @@ "source": [ "#### Code 11.56 and 11.57\n", "\n", - "The model described in the book does not sample well in PyMC3. It does slightly better if we change the pivot category to be the first career instead of the third, but this is still suboptimal because we are discarding predictive information from the pivoted category (i.e., its unique career income). \n", + "The model described in the book does not sample well in PyMC. It does slightly better if we change the pivot category to be the first career instead of the third, but this is still suboptimal because we are discarding predictive information from the pivoted category (i.e., its unique career income). \n", "\n", "In fact, it is not necessary to pivot the coefficients of variables that are distinct for each category (what the author calls predictors matched to outcomes), as it is done for the coefficients of shared variables (what the author calles predictors matched to observations). The intercepts belong to the second category, and as such they still need to be pivoted. These two references explain this distinction clearly: \n", "\n", @@ -5196,7 +5196,7 @@ "numpy 1.18.1\n", "theano 1.0.4\n", "matplotlib 3.1.3\n", - "pymc3 3.8\n", + "pymc 3.8\n", "arviz 0.7.0\n", "pandas 0.25.3\n", "last updated: Thu Apr 23 2020 \n", diff --git a/Rethinking_2/Chp_12.ipynb b/Rethinking_2/Chp_12.ipynb index 5b9d64c..a90d65e 100644 --- a/Rethinking_2/Chp_12.ipynb +++ b/Rethinking_2/Chp_12.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import scipy as sp\n", "import theano.tensor as tt\n", "\n", @@ -739,7 +739,7 @@ "text": [ "Sampling 4 chains for 2_000 tune and 2_000 draw iterations (8_000 + 8_000 draws total) took 19 seconds.\n", "The number of effective samples is smaller than 25% for some parameters.\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:613: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", " \"Estimated shape parameter of Pareto distribution is greater than 0.7 for \"\n" ] }, @@ -825,13 +825,13 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (8000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (50000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (50000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n", - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (50000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (50000) than draws (100). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -3337,7 +3337,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/plots/pairplot.py:167: UserWarning: fill_last and contour will be deprecated. Please use kde_kwargs\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/plots/pairplot.py:167: UserWarning: fill_last and contour will be deprecated. Please use kde_kwargs\n", " \"fill_last and contour will be deprecated. Please use kde_kwargs\", UserWarning,\n" ] }, @@ -3596,7 +3596,7 @@ "theano 1.0.4\n", "numpy 1.18.1\n", "pandas 0.25.3\n", - "pymc3 3.8\n", + "pymc 3.8\n", "scipy 1.4.1\n", "last updated: Fri Apr 24 2020 \n", "\n", @@ -3614,9 +3614,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/Chp_13.ipynb b/Rethinking_2/Chp_13.ipynb index 8a5e7a7..93fabdc 100644 --- a/Rethinking_2/Chp_13.ipynb +++ b/Rethinking_2/Chp_13.ipynb @@ -10,7 +10,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from scipy import stats\n", "from scipy.special import expit as logistic" @@ -1149,7 +1149,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/stats/stats.py:1320: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/stats/stats.py:1320: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " \"For one or more samples the posterior variance of the log predictive \"\n" ] @@ -1804,7 +1804,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This part is Stan related. To do the same in PyMC3 (i.e., avoid compiling the same model twice), you need to set up the input data with `pm.Data`. There are examples in this repository, and you can also take a look at [this tutorial](https://docs.pymc.io/notebooks/data_container.html)" + "This part is Stan related. To do the same in PyMC (i.e., avoid compiling the same model twice), you need to set up the input data with `pm.Data`. There are examples in this repository, and you can also take a look at [this tutorial](https://docs.pymc.io/notebooks/data_container.html)" ] }, { @@ -2866,7 +2866,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/plots/pairplot.py:167: UserWarning: fill_last and contour will be deprecated. Please use kde_kwargs\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/plots/pairplot.py:167: UserWarning: fill_last and contour will be deprecated. Please use kde_kwargs\n", " \"fill_last and contour will be deprecated. Please use kde_kwargs\", UserWarning,\n" ] }, @@ -3091,7 +3091,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/plots/pairplot.py:167: UserWarning: fill_last and contour will be deprecated. Please use kde_kwargs\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/plots/pairplot.py:167: UserWarning: fill_last and contour will be deprecated. Please use kde_kwargs\n", " \"fill_last and contour will be deprecated. Please use kde_kwargs\", UserWarning,\n" ] }, @@ -3810,7 +3810,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -3923,7 +3923,7 @@ "Attributes:\n", " created_at: 2020-05-18T15:37:47.591223\n", " arviz_version: 0.7.0\n", - " inference_library: pymc3\n", + " inference_library: pymc\n", " inference_library_version: 3.8" ] }, @@ -4050,7 +4050,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -4103,7 +4103,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -4149,7 +4149,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc3/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", + "/Users/alex_andorra/opt/anaconda3/envs/stat-rethink-pymc/lib/python3.7/site-packages/arviz/data/base.py:146: UserWarning: More chains (4000) than draws (4). Passed array should have shape (chains, draws, *shape)\n", " UserWarning,\n" ] }, @@ -4231,7 +4231,7 @@ "output_type": "stream", "text": [ "scipy 1.4.1\n", - "pymc3 3.8\n", + "pymc 3.8\n", "numpy 1.18.1\n", "pandas 0.25.3\n", "arviz 0.7.0\n", @@ -4252,9 +4252,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/Chp_14.ipynb b/Rethinking_2/Chp_14.ipynb index a7345d9..c99c1d2 100644 --- a/Rethinking_2/Chp_14.ipynb +++ b/Rethinking_2/Chp_14.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from matplotlib.patches import Ellipse, transforms\n", "from scipy import stats\n", @@ -5370,7 +5370,7 @@ "source": [ "#### Code 14.46\n", "\n", - "Related to Stan. PyMC3's GP module automatically reparametrizes with the Cholesky factor of the covariance matrix under the hood." + "Related to Stan. PyMC's GP module automatically reparametrizes with the Cholesky factor of the covariance matrix under the hood." ] }, { @@ -6193,9 +6193,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This is a good opportunity to show a use-case of PyMC3's GP module. In the Oceanic tools example above, we didn't need a mean function (which means it was automatically set to 0 by PyMC3). Now however, we need both a mean function _and_ a covariance function to specify our GP. The covariance function will look familiar. For the mean function, we could use `gp.mean.Linear`, which takes as input a matrix of coefficients and a vector of intercepts. But that mean function would then be evaluated on our distance matrix, as `SIGMA` will be.\n", + "This is a good opportunity to show a use-case of PyMC's GP module. In the Oceanic tools example above, we didn't need a mean function (which means it was automatically set to 0 by PyMC). Now however, we need both a mean function _and_ a covariance function to specify our GP. The covariance function will look familiar. For the mean function, we could use `gp.mean.Linear`, which takes as input a matrix of coefficients and a vector of intercepts. But that mean function would then be evaluated on our distance matrix, as `SIGMA` will be.\n", "\n", - "We don't want that -- we only want the mean function to depend on `M` and `G` not on the phylogenetic distance. We can easily [define a custom mean function](https://docs.pymc.io/notebooks/GP-MeansAndCovs.html#Defining-a-custom-mean-function) in PyMC3. We just need to subclass `pm.gp.mean.Mean` and provide `__call__` and `__init__` methods:" + "We don't want that -- we only want the mean function to depend on `M` and `G` not on the phylogenetic distance. We can easily [define a custom mean function](https://docs.pymc.io/notebooks/GP-MeansAndCovs.html#Defining-a-custom-mean-function) in PyMC. We just need to subclass `pm.gp.mean.Mean` and provide `__call__` and `__init__` methods:" ] }, { @@ -6547,7 +6547,7 @@ "pandas 0.25.3\n", "theano 1.0.4\n", "arviz 0.9.0\n", - "pymc3 3.9.2\n", + "pymc 3.9.2\n", "last updated: Wed Jul 01 2020 \n", "\n", "CPython 3.7.6\n", @@ -6565,9 +6565,9 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "stat-rethink-pymc3", + "display_name": "stat-rethink-pymc", "language": "python", - "name": "stat-rethink-pymc3" + "name": "stat-rethink-pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/Chp_15.ipynb b/Rethinking_2/Chp_15.ipynb index 6be3793..d2f4ad2 100644 --- a/Rethinking_2/Chp_15.ipynb +++ b/Rethinking_2/Chp_15.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import theano.tensor as tt\n", "\n", "from numpy.random import default_rng\n", @@ -1385,7 +1385,7 @@ " nu = pm.Normal(\"nu\", 0, 0.5)\n", " a = pm.Normal(\"a\", 0, 0.5)\n", "\n", - " # PyMC3 automatically imputes missing values\n", + " # PyMC automatically imputes missing values\n", " Bi = pm.Normal(\"Bi\", nu, sigma_B, observed=B)\n", "\n", " mu = a + bB * Bi + bM * M\n", @@ -2561,7 +2561,7 @@ "output_type": "stream", "text": [ "arviz 0.10.0\n", - "pymc3 3.9.3\n", + "pymc 3.9.3\n", "pandas 1.0.3\n", "numpy 1.18.1\n", "last updated: Sat Oct 03 2020 \n", diff --git a/Rethinking_2/Chp_16.ipynb b/Rethinking_2/Chp_16.ipynb index e1707ed..ee70636 100644 --- a/Rethinking_2/Chp_16.ipynb +++ b/Rethinking_2/Chp_16.ipynb @@ -12,7 +12,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from numpy.random import default_rng\n", "from theano import tensor as tt" @@ -281,7 +281,7 @@ } ], "source": [ - "# A more native pymc3/Arviz representation\n", + "# A more native pymc/Arviz representation\n", "axes = az.plot_pair(trace_16_1, var_names=[\"k\", \"p\"], kind=\"scatter\", marginals=True)\n", "corr = np.corrcoef(trace_16_1[\"p\"], trace_16_1[\"k\"])[0, 1]\n", "axes[1, 0].text(15, 0.4, f\"ρ = {corr:.2f}\", fontsize=15);" @@ -640,7 +640,7 @@ "text": [ "pandas 1.0.3\n", "numpy 1.18.2\n", - "pymc3 3.9.2\n", + "pymc 3.9.2\n", "arviz 0.10.0\n", "last updated: Wed Dec 09 2020 \n", "\n", diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_2.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_2.ipynb index f2fd1ec..96a7146 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_2.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_2.ipynb @@ -10,7 +10,7 @@ "source": [ "import arviz as az\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from matplotlib import pylab as plt\n", "from scipy import stats" @@ -587,7 +587,7 @@ "scipy : 1.5.2\n", "matplotlib: 3.3.2\n", "numpy : 1.19.1\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "\n", "Watermark: 2.1.0\n", "\n" @@ -604,9 +604,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_3.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_3.ipynb index dfc6e0c..623a3f0 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_3.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_3.ipynb @@ -10,7 +10,7 @@ "source": [ "import arviz as az\n", "import numpy as np\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from matplotlib import pylab as plt\n", "from scipy import stats" @@ -48,7 +48,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "All of this chapter depends on the posterior distribution for the globe spinning example. I will implement pymc3 to do most of the leg work for me. As before, set the prior to be the uniform and the likelihood to be the binomial. The data given in the book is the set of outcomes W L W W W L W L W, which I'll give a binary representation in the same order.\n", + "All of this chapter depends on the posterior distribution for the globe spinning example. I will implement pymc to do most of the leg work for me. As before, set the prior to be the uniform and the likelihood to be the binomial. The data given in the book is the set of outcomes W L W W W L W L W, which I'll give a binary representation in the same order.\n", "\n", "Pymc3 nicely allows you to state the prior and the likelihood function of the data. You can use its pm.sample function in order to obtain a random sample from the posterior distribution. This is done using MCMC techniques, but they aren't introduced until later in Statistical rethinking. You can run \"chains\" of the sampling procedure to sanity check the MCMC methods that took place. The samples from the posterior distribution are also returned and we can perform inference on the posterior according to this." ] @@ -1350,7 +1350,7 @@ "Python version : 3.8.5\n", "IPython version : 7.18.1\n", "\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "matplotlib: 3.3.2\n", "arviz : 0.9.0\n", "scipy : 1.5.2\n", @@ -1371,9 +1371,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_4.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_4.ipynb index e71bcff..35ae1f5 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_4.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_4.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from matplotlib import pylab as plt\n", @@ -1629,7 +1629,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -1678,7 +1678,7 @@ "IPython version : 7.18.1\n", "\n", "arviz : 0.9.0\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "scipy : 1.5.2\n", "seaborn : 0.11.0\n", "numpy : 1.19.1\n", @@ -1700,9 +1700,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_5.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_5.ipynb index 46840d6..d2ab2d7 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_5.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_5.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from causalgraphicalmodels import CausalGraphicalModel\n", @@ -221,11 +221,11 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", " warnings.warn(\n", ":12: UserWarning: This figure was using constrained_layout==True, but that is incompatible with subplots_adjust and or tight_layout: setting constrained_layout==False. \n", " plt.tight_layout();\n" @@ -266,7 +266,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We can now perform our linear regressions on these models. I'll just use pymc3 MCMC tool to estimate this and not bother with Laplace's method for now. I'll fit two linear models to the data, both of which will attempt to predict child IQ. The first model will use just parental income and the second will make use of both parental income and parental IQ. As I generated this data in such a way as for the parental income to be spurious, we should see the first model have a positive slope parameter and the second model should have zero slope parameter for the parental income variable, as we're controlling for the true cause. More formally\n", + "We can now perform our linear regressions on these models. I'll just use pymc MCMC tool to estimate this and not bother with Laplace's method for now. I'll fit two linear models to the data, both of which will attempt to predict child IQ. The first model will use just parental income and the second will make use of both parental income and parental IQ. As I generated this data in such a way as for the parental income to be spurious, we should see the first model have a positive slope parameter and the second model should have zero slope parameter for the parental income variable, as we're controlling for the true cause. More formally\n", "\n", "### Model 1\n", "\n", @@ -3510,7 +3510,7 @@ "Python version : 3.8.5\n", "IPython version : 7.18.1\n", "\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "arviz : 0.9.0\n", "seaborn : 0.11.0\n", "numpy : 1.19.1\n", @@ -3532,9 +3532,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_6.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_6.ipynb index cd98ad9..b035922 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_6.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_6.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from causalgraphicalmodels import CausalGraphicalModel\n", @@ -319,9 +319,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", " warnings.warn(\n" ] }, @@ -1325,7 +1325,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We can use pymc3 to perform the regression conditioned on whether each state is in the south of not." + "We can use pymc to perform the regression conditioned on whether each state is in the south of not." ] }, { @@ -1706,11 +1706,11 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -2551,9 +2551,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -2730,9 +2730,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -3097,7 +3097,7 @@ "IPython version : 7.18.1\n", "\n", "scipy : 1.5.2\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "matplotlib: 3.3.2\n", "pandas : 1.1.3\n", "arviz : 0.9.0\n", diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_7.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_7.ipynb index 70fc750..eb254a1 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_7.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_7.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from causalgraphicalmodels import CausalGraphicalModel\n", @@ -739,7 +739,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -1166,7 +1166,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -1360,10 +1360,10 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:682: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:682: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", " warnings.warn(\n" ] } @@ -1383,9 +1383,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -1551,7 +1551,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -1571,9 +1571,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -1760,10 +1760,10 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:682: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:682: UserWarning: Estimated shape parameter of Pareto distribution is greater than 0.7 for one or more samples. You should consider using a more robust model, this is because importance sampling is less likely to work well if the marginal posterior and LOO posterior are very different. This is more likely to happen with a non-robust model and highly influential observations.\n", " warnings.warn(\n" ] } @@ -1783,9 +1783,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -1955,7 +1955,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -1975,9 +1975,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -2687,7 +2687,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/pymc3/sampling.py:1707: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/pymc/sampling.py:1707: UserWarning: samples parameter is smaller than nchains times ndraws, some draws and/or chains may not be represented in the returned posterior predictive sample\n", " warnings.warn(\n" ] }, @@ -3221,7 +3221,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -3512,7 +3512,7 @@ "IPython version : 7.18.1\n", "\n", "arviz : 0.9.0\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "seaborn : 0.11.0\n", "matplotlib: 3.3.2\n", "pandas : 1.1.3\n", @@ -3534,9 +3534,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_8.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_8.ipynb index 6e0c678..6eb5485 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_8.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_8.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "import seaborn as sns\n", "\n", "from causalgraphicalmodels import CausalGraphicalModel\n", @@ -769,7 +769,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -1782,9 +1782,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -1829,7 +1829,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -1890,9 +1890,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n", - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:483: FutureWarning: hdi currently interprets 2d data as (draw, shape) but this will change in a future release to (chain, draw) for coherence with other functions\n", " warnings.warn(\n" ] }, @@ -3063,7 +3063,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -4073,7 +4073,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/stats/stats.py:1413: UserWarning: For one or more samples the posterior variance of the log predictive densities exceeds 0.4. This could be indication of WAIC starting to fail. \n", "See http://arxiv.org/abs/1507.04544 for details\n", " warnings.warn(\n" ] @@ -4127,7 +4127,7 @@ "\n", "matplotlib: 3.3.2\n", "numpy : 1.19.1\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "arviz : 0.9.0\n", "seaborn : 0.11.0\n", "pandas : 1.1.3\n", @@ -4147,9 +4147,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/End_of_chapter_problems/Chapter_9.ipynb b/Rethinking_2/End_of_chapter_problems/Chapter_9.ipynb index 03e3b66..10acaed 100644 --- a/Rethinking_2/End_of_chapter_problems/Chapter_9.ipynb +++ b/Rethinking_2/End_of_chapter_problems/Chapter_9.ipynb @@ -11,7 +11,7 @@ "import arviz as az\n", "import numpy as np\n", "import pandas as pd\n", - "import pymc3 as pm\n", + "import pymc as pm\n", "\n", "from matplotlib import pylab as plt" ] @@ -727,7 +727,7 @@ "\n", "#### Answers:\n", "\n", - "To translate terms from the book into pymc3:\n", + "To translate terms from the book into pymc:\n", "\n", "n_eff = ess_mean\n", "\n", @@ -1800,7 +1800,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/data/io_pymc3.py:85: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/data/io_pymc3.py:85: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.\n", " warnings.warn(\n" ] }, @@ -3027,7 +3027,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/aidan/anaconda3/envs/pymc3/lib/python3.8/site-packages/arviz/plots/backends/matplotlib/pairplot.py:212: UserWarning: rcParams['plot.max_subplots'] (40) is smaller than the number of resulting pair plots with these variables, generating only a 8x8 grid\n", + "/home/aidan/anaconda3/envs/pymc/lib/python3.8/site-packages/arviz/plots/backends/matplotlib/pairplot.py:212: UserWarning: rcParams['plot.max_subplots'] (40) is smaller than the number of resulting pair plots with these variables, generating only a 8x8 grid\n", " warnings.warn(\n" ] }, @@ -3204,7 +3204,7 @@ "IPython version : 7.18.1\n", "\n", "arviz : 0.9.0\n", - "pymc3 : 3.9.3\n", + "pymc : 3.9.3\n", "pandas : 1.1.3\n", "matplotlib: 3.3.2\n", "numpy : 1.19.1\n", @@ -3224,9 +3224,9 @@ "encoding": "# -*- coding: utf-8 -*-" }, "kernelspec": { - "display_name": "pymc3", + "display_name": "pymc", "language": "python", - "name": "pymc3" + "name": "pymc" }, "language_info": { "codemirror_mode": { diff --git a/Rethinking_2/README.md b/Rethinking_2/README.md index a924f67..c0ff375 100644 --- a/Rethinking_2/README.md +++ b/Rethinking_2/README.md @@ -1,8 +1,8 @@ -# Statistical Rethinking (second edition) with Python and PyMC3 +# Statistical Rethinking (second edition) with Python and PyMC [Statistical Rethinking](http://xcelab.net/rm/statistical-rethinking/) is an incredible introductory book to Bayesian Statistics. It follows a [_Jaynesian_](https://en.wikipedia.org/wiki/Edwin_Thompson_Jaynes) and practical approach with very good examples and clear explanations. -In this repository we port [the book's original code in R and Stan](https://github.com/rmcelreath/rethinking) to Python and PyMC3. We attempt to reproduce the examples as faithfully as possible while expressing them in a _Pythonic_ and _PyMC3onic_ way. +In this repository we port [the book's original code in R and Stan](https://github.com/rmcelreath/rethinking) to Python and PyMC. We attempt to reproduce the examples as faithfully as possible while expressing them in a _Pythonic_ and _PyMConic_ way. ## Display notebooks [![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/pymc-devs/resources/master?filepath=Rethinking_2) @@ -13,9 +13,9 @@ In this repository we port [the book's original code in R and Stan](https://gith All contributions are welcome! -Feel free to send PRs to fix errors, improve the code, or make comments that could help users of this repository and readers of the book. When submitting PRs, please make sure the notebooks are formatted according to the [PyMC NB style guide](https://github.com/pymc-devs/pymc3/wiki/PyMC's-Jupyter-Notebook-Style). +Feel free to send PRs to fix errors, improve the code, or make comments that could help users of this repository and readers of the book. When submitting PRs, please make sure the notebooks are formatted according to the [PyMC NB style guide](https://github.com/pymc-devs/pymc/wiki/PyMC's-Jupyter-Notebook-Style). -You can also join the discussion on [Gitter](https://gitter.im/Statistical-Rethinking-with-Python-and-PyMC3/Lobby). +You can also join the discussion on [Gitter](https://gitter.im/Statistical-Rethinking-with-Python-and-PyMC/Lobby). ## Installing the dependencies @@ -27,7 +27,7 @@ to install all the dependencies into an isolated environment. Activate the environment by running: - source activate stat-rethink2-pymc3 + source activate stat-rethink2-pymc To use the notebooks you first have to register your new environment as a valid notebook kernel: @@ -45,4 +45,4 @@ from the root directory. --- -Creative Commons License
Statistical Rethinking with Python and PyMC3 by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. +Creative Commons License
Statistical Rethinking with Python and PyMC by All Contributors is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/Rethinking_2/environment.yml b/Rethinking_2/environment.yml index 7e6f91c..d19d05a 100644 --- a/Rethinking_2/environment.yml +++ b/Rethinking_2/environment.yml @@ -1,4 +1,4 @@ -name: stat-rethink2-pymc3 +name: stat-rethink2-pymc channels: - conda-forge dependencies: @@ -16,3 +16,8 @@ dependencies: - pip: - daft - causalgraphicalmodels + - watermark + - "git+git://github.com/arviz-devs/arviz.git@main" + - "git+git://github.com/pymc-devs/pymc.git@main" + - causalgraphicalmodels + - daft