-
Notifications
You must be signed in to change notification settings - Fork 6
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
The example code does not work. #4
Comments
Thanks for reporting, sorry for the delay, and just pushed a fix: swapped |
I understand! Thank you very much for making the time to fix sampled. The two examples from the Readme.md document worked for me after I upgraded with sudo -H python3.5 -m pip install --upgrade git+https://github.com/ColCarroll/sampled.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get the error message when using the example code:
I used python3.5 and
numpy version: 1.13.3
pymc3 version: 3.2
ValueError: Input dimension mis-match. (input[0].shape[1] = 1000, input[1].shape[1] = 10)
import numpy as np
import pymc3 as pm
from sampled import sampled
@SampleD
def linear_model(X, y):
shape = X.shape
X = pm.Normal('X', mu=np.mean(X, axis=0), sd=np.std(X, axis=0), shape=shape)
coefs = pm.Normal('coefs', mu=np.zeros(shape[1]), sd=np.ones(shape[1]), shape=shape[1])
pm.Normal('y', mu=np.dot(X, coefs), sd=np.ones(shape[0]), shape=shape[0])
X = np.random.normal(size=(1000, 10))
w = np.random.normal(size=10)
y = X.dot(w) + np.random.normal(scale=0.1, size=1000)
with linear_model(X=X, y=y):
sampled_coefs = pm.sample(draws=500, tune=500)
np.allclose(sampled_coefs.get_values('coefs').mean(axis=0), w, atol=0.1) # True
The text was updated successfully, but these errors were encountered: