Skip to content
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

WIP Allow downcast in metropolis and nuts functions. #1265

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pymc3/step_methods/metropolis.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def tune(scale, acc_rate):

class BinaryMetropolis(ArrayStep):
"""Metropolis-Hastings optimized for binary variables

Parameters
----------
vars : list
Expand All @@ -195,7 +195,7 @@ class BinaryMetropolis(ArrayStep):
The frequency of tuning. Defaults to 100 iterations.
model : PyMC Model
Optional model for sampling step. Defaults to None (taken from context).

"""

def __init__(self, vars, scaling=1., tune=True, tune_interval=100, model=None):
Expand Down Expand Up @@ -294,6 +294,6 @@ def delta_logp(logp, vars, shared):

logp1 = CallableTensor(logp0)(inarray1)

f = theano.function([inarray1, inarray0], logp1 - logp0)
f = theano.function([inarray1, inarray0], logp1 - logp0, allow_input_downcast=True)
f.trust_input = True
return f
2 changes: 1 addition & 1 deletion pymc3/step_methods/nuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,6 @@ def leapfrog1_dE(logp, vars, shared, pot, profile):
E0 = energy(H, q0, p0)
dE = E - E0

f = theano.function([q, p, e, q0, p0], [q1, p1, dE], profile=profile)
f = theano.function([q, p, e, q0, p0], [q1, p1, dE], profile=profile, allow_input_downcast=True)
f.trust_input = True
return f