-
-
Notifications
You must be signed in to change notification settings - Fork 59
Re-working as_model
#275
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
Definitely the second, I don't think a user should have to remember to call the helper. In the previous we also deal with coords transparently. |
I prefer the second. As long as it works for |
You may have no need for |
Hmm, I think I'd rather keep the one model. Unless my current workflow is bad practice or I've missed the point: m = model(data=data, coords=coords)
idata = pm.sample(
model=m,
return_inferencedata=True,
)
idata.extend(pm.sample_posterior_predictive(idata, model=m, predictions=False))
pm.set_data(new_data=data_predict, model=m)
idata.extend(pm.sample_posterior_predictive(idata, model=m, predictions=True)) tbf, I guess replacing the |
I'm starting to appreciate @ricardoV94 's approach of simply having a prediction model that uses the trace of the fitted model, and not have to worry about changing coords. I'm confused by the example above -- |
That would happen when calling pm.sample_posterior_predictive with the idata from sampling |
So the missing steps are: trace = pm.sample(model=m_train)
pm.sample_posterior_predictive(trace, model=m_test, extend_inferencedata=True) The nice thing here is that it avoids having to set up placeholder vars when you build a separate prediction model. Yeah, I like the second one. |
Still in favor of the second. |
With either of the above workflows your code can look like this: m = model(data=data, coords=coords)
idata = pm.sample(model=m)
pm.sample_posterior_predictive(idata, model=m, predictions=False, extend_inferencedata=True)
m_new = model(data=data_predict, coords=new_coords)
pm.sample_posterior_predictive(idata, model=m_new, predictions=True, extend_inferencedata=True) |
Thanks everyone for your feedback! |
Since it's still new. The
as_model
decorator is nice, but for models wherecoords
would change it could have better ergonomics. I've explored using a helper methodadd_coords
But @ricardoV94 pointed out that we could return a function which took an additional
coords
orname
argument insteadI'm curious, which do people prefer?
The text was updated successfully, but these errors were encountered: