Skip to content

Commit

Permalink
Fixing bitwise_and bug in .fit methods
Browse files Browse the repository at this point in the history
  • Loading branch information
shz9 committed Jun 10, 2024
1 parent 8530ef0 commit 24e9eb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions viprs/model/VIPRS.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,12 @@ def fit(self,
prev_elbo = self.history['ELBO'][-2]

# Check for convergence in the objective + parameters:
if (i > min_iter) & np.isclose(prev_elbo, curr_elbo, atol=f_abs_tol, rtol=0.):
if (i > min_iter) and np.isclose(prev_elbo, curr_elbo, atol=f_abs_tol, rtol=0.):
self.optim_result.update(curr_elbo,
stop_iteration=True,
success=True,
message='Objective (ELBO) converged successfully.')
elif (i > min_iter) & max([np.max(np.abs(diff)) for diff in self.eta_diff.values()]) < x_abs_tol:
elif (i > min_iter) and max([np.max(np.abs(diff)) for diff in self.eta_diff.values()]) < x_abs_tol:
self.optim_result.update(curr_elbo,
stop_iteration=True,
success=True,
Expand Down
4 changes: 2 additions & 2 deletions viprs/model/gridsearch/VIPRSGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,13 @@ def fit(self,

for m in np.where(self.active_models)[0]:

if (i > min_iter) & np.isclose(prev_elbo[m], curr_elbo[m], atol=f_abs_tol, rtol=0.):
if (i > min_iter) and np.isclose(prev_elbo[m], curr_elbo[m], atol=f_abs_tol, rtol=0.):
self.active_models[m] = False
self.optim_results[m].update(curr_elbo[m],
stop_iteration=True,
success=True,
message='Objective (ELBO) converged successfully.')
elif (i > min_iter) & max([np.max(np.abs(diff[:, m]))
elif (i > min_iter) and max([np.max(np.abs(diff[:, m]))
for diff in self.eta_diff.values()]) < x_abs_tol:
self.active_models[m] = False
self.optim_results[m].update(curr_elbo[m],
Expand Down

0 comments on commit 24e9eb5

Please sign in to comment.