Pymc3: Coders!Bayes's lackeys and ML's underlings!Hear my call!!!Error【cannot unpack non-iterable ADVI object】

Created on 2 Dec 2018  ·  11Comments  ·  Source: pymc-devs/pymc3

If you have questions about a specific use case, or you are not sure whether this is a bug or not, please post it to our discourse channel: https://discourse.pymc.io

Description of your problem

I try like this:【pm.variational.ADVI】、【pm.variational.inference.ADVI】,and the error is still the same。
Sorry,my English is badly。。But I can Google~yeah(っ•̀ω•́)っ✎⁾⁾

Please provide a minimal, self-contained, and reproducible example.
``python [Your code here] with pm.Model() as hierarchical_model:
# 设置超先验
alpha_tmp_mu = pm.Normal('alpha_tmp_mu', mu=0, sd=10)
alpha_tmp_sd = pm.HalfNormal('alpha_tmp_sd', 10)
beta_mu = pm.Normal('beta_mu', mu=0, sd=10)
beta_sd = pm.HalfNormal('beta_sd', 10)

alpha_tmp = pm.Normal('alpha_tmp', mu=alpha_tmp_mu, sd=alpha_tmp_sd, shape=M)
beta = pm.Normal('beta', mu=beta_mu, sd=beta_sd, shape=M)
epsilon = pm.HalfCauchy('epsilon', 5)
nu = pm.Exponential('nu', 1 / 30)  # t分布自由度参数

y_pred = pm.StudentT('y_pred', mu=alpha_tmp[idx] + beta[idx] * x_centered, sd=epsilon, nu=nu, observed=y_m)

alpha = pm.Deterministic('alpha', alpha_tmp - beta * x_m.mean())
alpha_mu = pm.Deterministic('alpha_mu', alpha_tmp_mu - beta_mu * x_m.mean())
alpha_sd = pm.Deterministic('alpha_sd', alpha_tmp_mu - beta_mu * x_m.mean())

mu, sds, elbo = pm.ADVI(n=100000, verbose=False)`

**Please provide the full traceback.** ```python [The error output here] `WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string. WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions. Traceback (most recent call last): File "F:/PyCharm 2018.3/Global_Observer.py", line 42, in <module> mu, sds, elbo = pm.ADVI() TypeError: cannot unpack non-iterable ADVI object

Please provide any additional information below.

Versions and main components

Most helpful comment

You can link to a conda env from pycharm:
https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html
https://www.jetbrains.com/help/pycharm-edu/adding-existing-virtual-environment.html

Also, if you just started learning PyMC3 and Bayesian statistics, using jupyter notebook or jupyterlab is WAY better than an IDE like pycharm.

All 11 comments

Hi, we've updated our api long time ago. Now VI is object oriented. These docs might be useful
https://docs.pymc.io/notebooks/variational_api_quickstart.html

Hi, we've updated our api long time ago. Now VI is object oriented. These docs might be useful
https://docs.pymc.io/notebooks/variational_api_quickstart.html

@ferrine
(づ。◕ᴗᴗ◕。)づMasterCould u tell me some books about Pymc3??I have 《Bayesian Analysis with Python》and 《Bayesian Methods for Hackers》But its just not enough!!
I like Pymc3~~yeah!

And!And!
I install some like "mingw-w64-install"、"tdm64-gcc-5.1.0-2" fixs for WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations............to my surprise! New WARNING happen "ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。"

Master help me~~~(ಥ_ಥ)

You might want to setup your environment using conda, it takes care of the dependencies you need.

You might want to setup your environment using conda, it takes care of the dependencies you need.

|ू・ω・` )~Master~~The code can runs before fix "g++ not detected ! Theano will be unable to execute optimized C..."

New WARNING "ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。" appears in
`with pm.Model() as hierarchical_model:
# 设置超先验
alpha_tmp_mu = pm.Normal('alpha_tmp_mu', mu=0, sd=10) <<-----【WARING happen~~】
alpha_tmp_sd = pm.HalfNormal('alpha_tmp_sd', 10)
beta_mu = pm.Normal('beta_mu', mu=0, sd=10)
``

MasterHelpHelp me!~~

You can try to follow these instructions. If you installed everything using conda it should work, as stated in this old issue.

You can try to follow these instructions. If you installed everything using conda it should work, as stated in this old issue.

You are NICE!Dr.Mathew ~~─=≡Σ(((つ•̀ω•́)つ
But sadly. I using Pycharm,not conda....I indeed try to follow these instructions~Like: "mingw-w64-install"、"tdm64-gcc-5.1.0-2"
But new WARNING:ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败

Today,i uninstall "mingw-w64-install"、"tdm64-gcc-5.1.0-2"。New WARNING is gone,but u know "g++ not detected ! Theano will be unable to execute optimized C..." will be happen~

I truly don't like conda,i like Pycharm。HELP me!Dr.Mathew
(〃'▽'〃)

You can use conda with pycharm, pycharm is an IDE, anaconda is a package manager. It's by far the best way to install pymc3, especially under windows.

You can link to a conda env from pycharm:
https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html
https://www.jetbrains.com/help/pycharm-edu/adding-existing-virtual-environment.html

Also, if you just started learning PyMC3 and Bayesian statistics, using jupyter notebook or jupyterlab is WAY better than an IDE like pycharm.

You can use conda with pycharm, pycharm is an IDE, anaconda is a package manager. It's by far the best way to install pymc3, especially under windows.

∑(っ°Д°;)っDear Thomas, are you serious?Could i Use conda can fix WARNING "g++ not detected"?I truly want to use Pycharm,not conda....

You can link to a conda env from pycharm:
https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html
https://www.jetbrains.com/help/pycharm-edu/adding-existing-virtual-environment.html

Also, if you just started learning PyMC3 and Bayesian statistics, using jupyter notebook or jupyterlab is WAY better than an IDE like pycharm.

ψ(*`ー´)ψI've done like these link...Look
qq 20181203173819

Indeed~~Google told me like "conda install mlk" "conda install libpython"。But, really use conda??
"Anaconda2-5.3.1-Windows-x86_64"??Right? Fight!!(o^-^)尸~''☆ミ☆ミ

@twiecki
Our Dear Thomas , please close this issue

Was this page helpful?
0 / 5 - 0 ratings