Skip to content
Merged
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
9 changes: 4 additions & 5 deletions cuqi/experimental/mcmc/_hmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ def __init__(self, target=None, initial_point=None, max_depth=15,

def _initialize(self):

# Arrays to store acceptance rate
self._acc = [None] # Overwrites acc from Sampler. TODO. Check if this is necessary

self._alpha = 0 # check if meaningful value
self._n_alpha = 0 # check if meaningful value

Expand Down Expand Up @@ -263,9 +260,9 @@ def step(self):
self.current_point = point_prime
self.current_target_logd = logd_prime
self.current_target_grad = np.copy(grad_prime)
self._acc.append(1)
acc = 1
else:
self._acc.append(0)
acc = 0

# update number of particles, tree level, and stopping criterion
n += n_prime
Expand All @@ -284,6 +281,8 @@ def step(self):
if np.isnan(self.current_target_logd):
raise NameError('NaN potential func')

return acc

def tune(self, skip_len, update_count):
""" adapt epsilon during burn-in using dual averaging"""
k = update_count+1
Expand Down
Loading