-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Changing amount of data gives Theano error #3007
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
Comments
Also, no reason to call |
You're absolutely right about x_t, which was a mistake in the example. But correcting this doesn't change the error. |
I am having the same problem trying to implement reloo (refit the model again for each observation with pareto_k > 0.7 to get their exact predictive accuracy as pareto_k > 0.7 indicates the approximation cannot be trusted, here the PR with links to working examples in emcee and PyStan) and Leave Future Out (see this repo for algorithm details) in ArviZ. My approach is basically the following: In [1]: import pymc3 as pm
...: with pm.Model() as model:
...: x = pm.Data('x', [1., 2., 3.])
...: y = pm.Data('y', [1., 2., 3.])
...: beta = pm.Normal('beta', 0, 1)
...: obs = pm.Normal('obs', x * beta, 1, observed=y)
...: trace = pm.sample(1000, tune=1000)
In [2]: with model:
...: pm.set_data({'x': [1, 2], 'y': [1, 2]})
...: loo_trace = pm.sample(1000, tune=1000)
See full error trace
Is there any way to resample the same model on a subset without having to write a new model? (for cross validation purposes for example) I have had no problem with sampling posterior predictive samples, nor to calculate the pointwise log likelihood (using |
@Monikasinghjmi this warning is because you are sampling far too few samples. A good default is 1000 samples with |
@fonnesbeck -when I tried with defaults, I get another warning "The gelman-rubin statistic is larger than 1.4 for some parameters. The sampler did not converge". |
Yeah, the default tuning is 500 iterations which is sometimes too few. The message implies that you need to sample more (specifically, under tuning). So add |
Same results in both cases "The derivative of RV |
Something is wrong with your model specification relative to your data. What does your model formula look like, and what does your data look like (maybe show the |
And there are 39 rows and 34 columns in the data |
You definitely need to normalize some of that data. There are multiple orders of magnitude difference between the covariates. Particularly if you are using the `glm` module, as the priors on beta are probably not suitable for covariates with magnitdes on the order of 1e7.
|
Thank you so much @fonnesbeck . It was because of the normalization issue. |
Excellent. If you have any usage questions going forward, our Discourse page is a good resource. |
Did you ever figure this issue out, or did you just move on? I'm getting this same issue when I add more parameters in my model and I'm not sure where to go from here. |
This one seems to work on main, and I believe we have tests for this: import numpy as np
import pymc as pm
import aesara
x0 = np.linspace(0, 1, 10)
x_t = aesara.shared(x0)
y_t = aesara.shared(5*x0)
with pm.Model():
w = pm.Normal('W', mu=0., tau=1.)
f = pm.Normal('f', mu=w*x_t, sd=1., observed=y_t)
trace = pm.sample(10, tune=2)
x1 = np.linspace(0, 1, 11)
x_t.set_value(x1)
y_t.set_value(np.sin(x1))
trace = pm.sample(10, tune=2) |
Uh oh!
There was an error while loading. Please reload this page.
Description of your problem
When I change the amount of data in a probabilistic model, it seems that the gradient still had the original size. Is there any way to change this without rebuilding the entire model?
Please provide a minimal, self-contained, and reproducible example.
Please provide the full traceback.
Please provide any additional information below.
Versions and main components
The text was updated successfully, but these errors were encountered: