Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobRobnik committed Feb 8, 2024
1 parent c0482d4 commit 42973d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions benchmarks/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ def __init__(self, d, condition_number, numpy_seed=None, prior= 'prior'):
self.name = 'icg'
self.d = d
self.condition_number = condition_number
eigs = jnp.logspace(-0.5 * jnp.log10(condition_number), 0.5 * jnp.log10(condition_number), d)

eigs = jnp.logspace(-0.5 * jnp.log10(condition_number), 0.5 * jnp.log10(condition_number), d) # eigenvalues of the covariance matrix
eigs /= jnp.average(eigs)

if numpy_seed == None: # diagonal
self.second_moments = eigs
self.R = jnp.eye(d)
self.Hessian = jnp.diag(1 / eigs)
self.Hessian = jnp.diag(1. / eigs)
self.Cov = jnp.diag(eigs)

else: # randomly rotate
Expand Down
2 changes: 0 additions & 2 deletions mclmc/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def update(eps, u, g):

def update_position(grad_nlogp, boundary):


def update(eps, x, u, sigma):
xx = x + eps * u * sigma
ll, gg = grad_nlogp(xx)
Expand All @@ -55,7 +54,6 @@ def update_with_boundary(eps, x, u, sigma):
ll, gg = grad_nlogp(xx)
uu = reflect * u
return xx, uu, ll, gg


return update if boundary == None else update_with_boundary

Expand Down

0 comments on commit 42973d7

Please sign in to comment.