-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Random initialization for NUTS #1744
Conversation
pymc3/examples/gelman_bioassay.py
Outdated
@@ -1,5 +1,5 @@ | |||
import pymc3 as pm | |||
from numpy import ones, array | |||
from pymc3 import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we prohibit this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, was testing and forgot to take it out.
Generalized to use with any step method |
pymc3/distributions/discrete.py
Outdated
@@ -389,7 +389,7 @@ def _random(self, lower, upper, size=None): | |||
# as array-like. | |||
samples = stats.uniform.rvs(lower, upper - lower - np.finfo(float).eps, | |||
size=size) | |||
return np.floor(samples).astype('int32') | |||
return np.floor(samples).astype('int64') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need int64 here? This causes problems with float32 interaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it. I think I was trying to diagnose a bug here. I will remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dtype='int64'
is the default for the Discrete
class. Should that be changed?
I will never understand |
Sometimes it's better to make a new branch from master and cherry-pick the commits you want (can squash them before to make that faster). |
Yes, I need to do that more. I am lazy. |
pymc3/sampling.py
Outdated
@@ -1,4 +1,4 @@ | |||
from collections import defaultdict | |||
rom collections import defaultdict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, fixed. Thanks.
Use ADVI to initialize NUTS for marginalizes GMM example
Fix multivariate metropolis proposal
Same rebase issue here. Closing. |
Added a
"random"
initialization option for NUTS that simply draws from the prior. Seems to work pretty well in some cases. Might be a good idea for initializing other samplers as well.