Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 2, 2024
1 parent 6399a33 commit b474849
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/emcee/moves/dime.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ class DIMEMove(RedBlueMove):
"""

def __init__(
self, sigma=1.0e-5, gamma=None, aimh_prob=0.1, df_proposal_dist=10, rho=.999, **kwargs
self,
sigma=1.0e-5,
gamma=None,
aimh_prob=0.1,
df_proposal_dist=10,
rho=0.999,
**kwargs
):
if multivariate_t is None:
raise ImportError(
Expand Down Expand Up @@ -87,24 +93,25 @@ def setup(self, coords):
self.update_proposal_dist(coords)

def propose(self, model, state):
"""Wrap original propose to get the some info on the current state
"""
"""Wrap original propose to get the some info on the current state"""

self.lprobs = state.log_prob
state, accepted = super(DIMEMove, self).propose(model, state)
self.accepted = accepted
return state, accepted

def update_proposal_dist(self, x):
"""Update proposal distribution with ensemble `x`
"""
"""Update proposal distribution with ensemble `x`"""

nchain, npar = x.shape

# log weight of current ensemble
if self.accepted.any():
lweight = logsumexp(self.lprobs) + \
np.log(sum(self.accepted)) - np.log(nchain)
lweight = (
logsumexp(self.lprobs)
+ np.log(sum(self.accepted))
- np.log(nchain)
)
else:
lweight = -np.inf

Expand All @@ -126,8 +133,7 @@ def update_proposal_dist(self, x):
self.cumlweight = newcumlweight

def get_proposal(self, x, xref, random):
"""Actual proposal function
"""
"""Actual proposal function"""

xref = xref[0]
nchain, npar = x.shape
Expand Down

0 comments on commit b474849

Please sign in to comment.