Skip to content

Tutorial Error for Trace Function #292

@Stefan-Physics

Description

@Stefan-Physics

Describe the bug
A clear and concise description of what the bug is.
In the tutorial whenever I have to use trace. For example, in ‘a quick intro to pymc3’, the code
trace = pm.sample(
draws=1000, tune=1000, chains=2, cores=2, return_inferencedata=True)
Gives an error:
“AttributeError: module 'arviz' has no attribute 'from_pymc3' “

To Reproduce
This section should include a simple, standalone code snippet that demonstrates the issue.

!pip install exoplanet
!python -m pip install -U "exoplanet[extras]"
!python -m pip install tensorflow==2.11.1
!python -m pip install tensorflow-datasets==4.9
!python -m pip install tensorflow-metadata==1.13
!python -m pip install protobuf==3.19.6
!python -m pip install pymc==5.1.1
!python -m pip install pymc3==3.11.4
import exoplanet as xo

import pymc3 as pm
import arviz as az

with pm.Model() as model:
m = pm.Uniform("m", lower=-5, upper=5)
b = pm.Uniform("b", lower=-5, upper=5)
logs = pm.Uniform("logs", lower=-5, upper=5)
pm.Normal("obs", mu=m * x + b, sd=pm.math.exp(logs), observed=y)
trace = pm.sample(
draws=1000, tune=1000, chains=2, cores=2, return_inferencedata=True
)

Expected behavior
A clear and concise description of what you expected to happen.
It should perform the trace function like in the tutorial.

Your setup (please complete the following information):

  • Version of exoplanet: 0.5.3
  • Operating system: IPad, google collab
  • Python version & installation method (pip, conda, etc.): !pip through google collab

Additional context
Add any other context about the problem here.

I believe this error is due to an update on pymc3 that “the Latest PyMC3 release (3.11.0) is the first to not include the alias such as pm.traceplot. You have to use [arviz.plot_trace]which works with PyMC3 objects.” OriolAbril from stack overflow.

Additionally, and maybe this is the problem. Due to some dependencies, I had to downgrade certain things in exoplanet to get it to run on google collaborator. The code to get it to run in collab is what I pasted earlier with the code I got the error from:

!pip install exoplanet
!python -m pip install -U "exoplanet[extras]"
!python -m pip install tensorflow==2.11.1
!python -m pip install tensorflow-datasets==4.9
!python -m pip install tensorflow-metadata==1.13
!python -m pip install protobuf==3.19.6
!python -m pip install pymc==5.1.1
!python -m pip install pymc3==3.11.4
import exoplanet as xo

Lastly, I am an undergraduate student, so I apologize if this is an elementary error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions