AttributeError: module 'pymc3.stats' has no attribute 'gelman_rubin'

No attribute ‘gelman_rubin’ error when calling the function. As per the latest documentations,
I should be calling it as pymc3.stats.gelman_rubin(trace) but it gives me an error. Am I doing an incorrect usage of the function?

Description of your problem

Please provide a minimal, self-contained, and reproducible example.

import matplotlib.pyplot as plt
import numpy as np
import pymc3
import scipy.stats as stats

# Parameter values for prior and analytic posterior
n = 50
z = 10
alpha = 12
beta = 12
alpha_post = 22
beta_post = 52

# How many iterations of the Metropolis 
# algorithm to carry out for MCMC
iterations = 100000

# Use PyMC3 to construct a model context
basic_model = pymc3.Model()
with basic_model:
    # Define our prior belief about the fairness
    # of the coin using a Beta distribution
    theta = pymc3.Beta("theta", alpha=alpha, beta=beta)

    # Define the Bernoulli likelihood function
    y = pymc3.Binomial("y", n=n, p=theta, observed=z)

    # Carry out the MCMC analysis using the Metropolis algorithm
    # Use Maximum A Posteriori (MAP) optimisation as initial value for MCMC
    start = pymc3.find_MAP() 

    # Use the Metropolis algorithm (as opposed to NUTS or HMC, etc.)
    step = pymc3.DEMetropolis()

    # Calculate the trace
    trace = pymc3.sample(iterations, step, start, random_seed=1, progressbar=True)

pymc3.stats.gelman_rubin(trace)

Please provide the full traceback.

AttributeError                            Traceback (most recent call last)
 in 
----> 1 pymc3.stats.gelman_rubin(trace)

AttributeError: module 'pymc3.stats' has no attribute 'gelman_rubin'

Versions and main components

  • PyMC3 Version: 3.9.1
  • Python Version: 3.6.9
  • Operating system: Ubuntu 18.01
  • How did you install PyMC3: pip

Hi,
Thanks for your question!
Plots and diagnostics are now handled by ArviZ. We haven’t compiled the docs for 3.9.1 yet (we’re in the middle of a docstring), but the new doc will redirect to ArviZ corresponding pages for plots and diagnostics.
Hope that helps :vulcan_salute:

1 Like

Thanks @AlexAndorra. Got it working in arviz.