AttributeError: module 'pymc3.stats' has no attribute 'gelman 您所在的位置:网站首页 gelman-rubin收敛诊断 AttributeError: module 'pymc3.stats' has no attribute 'gelman

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

2024-07-16 08:55| 来源: 网络整理| 查看: 265

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


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有