-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add wrapper for theano as_op #584
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
Hi Heiko, Seems to be a dupe of #507. E.g. @theano.compile.ops.as_op(itypes=[t.lscalar, t.dscalar, t.dscalar],otypes=[t.dvector])
def rate(switchpoint,early_mean, late_mean):
''' Concatenate Poisson means '''
out = empty(years)
out[:switchpoint] = early_mean
out[switchpoint:] = late_mean
return out Let me know if that works or doesn't work for you. |
Closing, feel free to reopen if this doesn't work for you. |
Hi Thomas, thanks for the help, that fixed the problem. Amazing! Now I can do pseudo-marginal MCMC models using PyMC, which is something I am working on and would like to use PyMC for. For others, here is how I did it: |
Cool, thanks for sharing! |
I also wonder if we should create a wrapper around @CustomDensity(itypes=[T.dscalar],otypes=[T.dscalar])
def MyCustomDist():...
with model:
my_dist = MyCustomDist('y', ...) |
Yes, that's true. I wonder if it should be T.dvector though, since that On Tue, Aug 19, 2014 at 4:55 AM, Thomas Wiecki [email protected]
|
I like it too. In favor of anything that hides the Theano complexity from most users. |
Theano/Theano#3094 issue should make it easier to make as_op make theano ops. |
Is this still something we worry about? Its pretty easy to create custom distributions now. |
Yeah, I think it's fine, haven't heard many complaints. |
Hi there,
is there a way to make pymc3 use custom density functions that are not theano compatible?
Say I have some black box c-code to evaluate my log-pdf, and now I want to use this with one of pymc3's gradient free samplers such as metropolis.
Currently, trying this gives me things like
object of type 'TensorVariable' has no len()
when trying to use my own python code to evaluate a log-pdf (which assumes the input is a numpy array).Thanks for your help and for the great package!
The text was updated successfully, but these errors were encountered: