-
-
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
Quickstart regression example fails -- ValueError: setting an array element with a sequence. #3618
Comments
Thank you for reporting - this is an important problem to fix! I can confirm I reproduce it on my machine, and here is a simple fix (swapping I can make a PR in a day or two if no one has a better fix (@fonnesbeck / @twiecki I think you two present the code the most): import pymc3 as pm
import numpy.random as npr
X = npr.randn(100, 1)
w = npr.randn(1)
y = X @ w + (npr.randn(100) * .1)
with pm.Model() as linear_model:
weights = pm.Normal('weights', mu=0, sigma=1)
noise = pm.Gamma('noise', alpha=2, beta=1)
y_observed = pm.Normal('y_observed',
mu=pm.math.dot(X, weights),
sigma=noise,
observed=y)
posterior = pm.sample() |
You can also just swap
|
Didn't realize this was 1-d. What about |
Sorry I didn't mean to show the 1-d example -- the same error also happens for N-d. I was just curious if the error persisted for 1-d. Swapping Thanks for the quick responses! |
This was a good example! I suspect the problem is that something in theano breaks with new numpy arrays. |
Just installed pymc3 and am having some trouble. Some simple examples seem to be working, but the example on the front page fails:
Interestingly, the following simpler example does work:
pymc3 version: 3.7
theano version: 1.0.4
Python version: 3.7.1
Edit: I get the same error if I try different dimensions (e.g.
w=npr.randn(100, 5)
)The text was updated successfully, but these errors were encountered: