-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example 8.21 may have some typos #1
Comments
Thanks for pointing out the typo! After correcting the typo you mentioned I ran the script here and got the expected result. what version of pymc3 are you using? |
That is excellent news! Thank for the fast response!
I was using version 3.1 from PyPI.
…On Tue, Nov 14, 2017 at 11:33 AM, Emille Ishida ***@***.***> wrote:
Thanks for pointing out the typo!
it has being corrected.
After correcting the typo you mentioned I ran the script here and got the
expected result.
pymc3.*version* = 3.0
what version of pymc3 are you using?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AOeSC6S07TSk05onPjgaGBSPp0aBZsmPks5s2c79gaJpZM4QdpgU>
.
--
Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center Rm. 466
Letter address: Shipping address:
P.O. Box 26901, BRC 466 975 NE 10th Street, BRC 466
Oklahoma City, OK 73190 Oklahoma City, OK 73104-5419
office: (405) 271-8300 lab: (405) 271-8313 fax: (405) 271-3910
e-mail: blaine-mooers@ouhsc.edu
(or bmooers1@gmail.com)
http://www.oumedicine.com/body.cfm?id=3877&oTopID=3877
|
Oh sure! just now I realized that you had written this information in your initial post. https://discourse.pymc.io/t/differenc-between-pymc-3-1-and-pymc-3-0-on-nuts/293/2 so, if we substitute line 54 with
it should run without problems. |
Hi Emille,
Thank you very much for finding the solution required to upgrade script
8.21!
The change on line 54 from 'state' to 'scaling' solved the problem for me
too.
Before your post today, I stepped back to pymc3 version 3.0. That also
worked.
To do so, I used the following command to uninstall pymc3.1 and reinstall
pymc3.0.
sudo -H python -m pip install 'pymc3==3.0' --force-reinstall
…On Wed, Nov 15, 2017 at 7:43 AM, Emille Ishida ***@***.***> wrote:
Oh sure! just now I realized that you had written this information in your
initial post.
The issue comes because from version 3.1 on there was a change on the
accepted NUTS options.
https://discourse.pymc.io/t/differenc-between-pymc-3-1-
and-pymc-3-0-on-nuts/293/2
so, if we substitute line 54 with
step = pm.NUTS(scaling=start)
it should run without problems.
let me know if this works for you!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AOeSC6dwOYmHimcdux0mbISKk_PIB1JKks5s2uqFgaJpZM4QdpgU>
.
--
Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center Rm. 466
Letter address: Shipping address:
P.O. Box 26901, BRC 466 975 NE 10th Street, BRC 466
Oklahoma City, OK 73190 Oklahoma City, OK 73104-5419
office: (405) 271-8300 lab: (405) 271-8313 fax: (405) 271-3910
e-mail: blaine-mooers@ouhsc.edu
(or bmooers1@gmail.com)
http://www.oumedicine.com/body.cfm?id=3877&oTopID=3877
|
good! my pleasure to help. I am happy to know that the fix worked. thanks again for pointing this out. |
I reinstalled pymc3 with pip and got version 3.2 installed.
It too works with the upgraded 8.21 script.
I had stepped back to pymc3 version 3.0 and then up with version 3.2 with
Python 2.7.
Although the script runs correctly, I got a message about needing to
manually
clear a cache associated with theano.
I ran the recommended
theano-cache clear
to no good effect.
I upgraded python3.5 and python3.6 to pymc3 version 3.2 from 3.1.
They both run the updated code_8.21.py script without the warning about
theano.
…On Wed, Nov 15, 2017 at 8:21 AM, Blaine Mooers ***@***.***> wrote:
Hi Emille,
Thank you very much for finding the solution required to upgrade script
8.21!
The change on line 54 from 'state' to 'scaling' solved the problem for me
too.
Before your post today, I stepped back to pymc3 version 3.0. That also
worked.
To do so, I used the following command to uninstall pymc3.1 and reinstall
pymc3.0.
sudo -H python -m pip install 'pymc3==3.0' --force-reinstall
On Wed, Nov 15, 2017 at 7:43 AM, Emille Ishida ***@***.***>
wrote:
> Oh sure! just now I realized that you had written this information in
> your initial post.
> The issue comes because from version 3.1 on there was a change on the
> accepted NUTS options.
>
> https://discourse.pymc.io/t/differenc-between-pymc-3-1-and-
> pymc-3-0-on-nuts/293/2
>
> so, if we substitute line 54 with
>
> step = pm.NUTS(scaling=start)
>
> it should run without problems.
> let me know if this works for you!
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1 (comment)>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AOeSC6dwOYmHimcdux0mbISKk_PIB1JKks5s2uqFgaJpZM4QdpgU>
> .
>
--
Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center Rm. 466
Letter address: Shipping address:
P.O. Box 26901, BRC 466 975 NE 10th Street, BRC 466
Oklahoma City, OK 73190 Oklahoma City, OK 73104-5419
office: (405) 271-8300 lab: (405) 271-8313 fax: (405) 271-3910
e-mail: ***@***.***
(or ***@***.***)
http://www.oumedicine.com/body.cfm?id=3877&oTopID=3877
--
Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center Rm. 466
Letter address: Shipping address:
P.O. Box 26901, BRC 466 975 NE 10th Street, BRC 466
Oklahoma City, OK 73190 Oklahoma City, OK 73104-5419
office: (405) 271-8300 lab: (405) 271-8313 fax: (405) 271-3910
e-mail: blaine-mooers@ouhsc.edu
(or bmooers1@gmail.com)
http://www.oumedicine.com/body.cfm?id=3877&oTopID=3877
|
PyMC3 example of NB regression in Code_8.21.py gives the following error message.
File "code_8.21.py", line 50, in
y = pm.NegativeBinomial('y', mu=pm.exp(eta), alpha=alpha, observed=y)
AttributeError: module 'pymc3' has no attribute 'exp'
I think that the pm.exp(eta) should be replaced with np.exp(eta).
I get the same result with Python2.7 and Python3.5.
I am using PyMC3 version 3.1.
After making the above change, the script runs for a much longer time and then throuws an error on line 54
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
from pandas.core import datetools
Optimization terminated successfully.
Current function value: 3854.710331
Iterations: 31
Function evaluations: 48
Gradient evaluations: 48
Traceback (most recent call last):
File "./code_8.21.py", line 54, in
step = pm.NUTS(state=start) # Initiate sampling
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/nuts.py", line 149, in init
super(NUTS, self).init(vars, use_single_leapfrog=True, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/base_hmc.py", line 64, in init
vars, shared, model.logpt, self.potential, use_single_leapfrog, integrator, **theano_kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/trajectory.py", line 124, in get_theano_hamiltonian_functions
energy_function, p = _theano_energy_function(H, q, **theano_kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymc3/step_methods/hmc/trajectory.py", line 54, in _theano_energy_function
energy_function = theano.function(inputs=[q, p], outputs=total_energy, **theano_kwargs)
TypeError: function() got an unexpected keyword argument 'state'
The text was updated successfully, but these errors were encountered: