-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Theano MissingInputError when running model with start argument in sample #2109
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
That's for sure a bug in ADVI start kwarg. |
Hm wait. You use metropolis and no init. That's another problem |
Could you please provide minimal failing example? I was not able to reproduce the error on a simple model |
@narendramukherjee Can you try if #2109 (now on master) fixed this for you? |
Hi guys, Thanks for the responses. Although, a simple linear regression fit with Metropolis doesn't give this error, I have reproduced it with a simple test case for the kind of model I am fitting. I am using the latest pymc3 version from master, and here's the versions again:
Here's the minimal example - the dataset has categorical emissions (0, 1, or 2) with probabilities that change twice - once at 100 samples and again at 200 samples. There are 2 trials of the data, each has 300 samples, and both of them change emission probabilities at 100 and 200 samples
And here's my model:
This model works fine if the 'start' argument isn't specified (I am sampling with init = None with Metropolis). However, if I specify the 'start' argument (as in the model above), sampling fails with the same error as previously (I have pasted the last part here again).
|
Just adding to my previous post - downgrading to the stable version of pymc3 (3.0) with the same theano version (0.9) allows this code to work with the 'start' argument specified. It seems like something's breaking down in the new development version.
|
The problem is t2 = pm.Uniform('t2', lower = t1 + 20, upper = 230, shape = 2) is depends on t1 = pm.Uniform('t1', lower = 30, upper = 130, shape = 2) but the point value of t1 is not pass to the |
@junpenglao - was just wondering what the status of this issue was. Did this get fixed? Thanks for your help! |
Not yet, for now, you need to pass the transformed variable to start value. a = pm.Uniform('a', lower=0., upper=1.)
b = pm.Uniform('b', lower=0., upper=1. - a1)
start = {'a': .5, 'b':.3} you need to transform the |
fixed in #2328 |
@junpenglao @twiecki The current development version (on the master branch of pymc3) still has issues with the minimal example I posted above. As I had said previously, that minimal example works fine with pymc3 3.0 and theano 0.9. Here's the versions I am using right now:
Here's the last part of the error that the minimal example I posted above produces (again note, this error doesn't come up if the start argument isn't specified):
Works fine without start argument not specified:
I also tried the transformation that @junpenglao suggested above. Same error comes up:
Here's the last part of the error:
|
Also, should we open the issue again as it looks like it wasn't resolved by the last few commits? Thanks a ton for all your attempts in trying to fix this! |
Thanks a lot for reporting back! |
Hi @narendramukherjee, PyMC3 now perform more rigorous test on the inputs, which is why the starting value you provide is failing: you need to feed the value with the right shape. In your example above, if you change your start value from: start = {'t1': 50.0, 't2': 150.0} (incorrect shape, as start = {'t1': np.ones(2)*50.0, 't2': np.ones(2)*150.0} It should work. The same also for when you are feeding the transformed start value. |
Thanks @junpenglao , that does solve the issue :) I am closing the issue, thank you so much for all your help! |
Uh oh!
There was an error while loading. Please reload this page.
This is a tangent from issue #2094 - I updated my versions of pymc3 and theano while testing out the model I mentioned in that issue. I am currently running:
Here's the model again (same as in #2094 ):
The model runs fine if I don't specify the start argument in pm.sample. However, if I specify the start argument, Theano throws this error (this model was working with the older versions of pymc3 and theano that I had previously):
Same model, sampled without the start argument:
The text was updated successfully, but these errors were encountered: