Skip to content

Commit ac52394

Browse files
committed
Refactor ELBO optimization: remove iteration count tracking and update progress bar correctly.
1 parent d9332cf commit ac52394

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

predicators/approaches/pp_param_learning_approach.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ def _learn_process_parameters(self,
138138
# num_q_params, num_processes)
139139

140140
# Keep track of iterations for progress display
141-
iteration_count = 0
142141
best_elbo = -np.inf
143142
progress_bar = tqdm(desc="Optim. params.", unit="iter")
144143

@@ -148,13 +147,11 @@ def objective(params):
148147
149148
It does some preparation and then calls the -ELBO function.
150149
"""
151-
nonlocal iteration_count, best_elbo
150+
nonlocal best_elbo
152151
nonlocal start_times
153152
nonlocal all_possible_atoms
154153
nonlocal atom_to_val_to_gps
155154

156-
iteration_count += 1
157-
progress_bar.update(1)
158155

159156
self._set_process_parameters(params[1:num_proc_params])
160157
guide_params = params[num_proc_params:]
@@ -179,6 +176,7 @@ def objective(params):
179176
'Current ELBO': f'{elbo_val:.4f}',
180177
'Best ELBO': f'{best_elbo:.4f}'
181178
})
179+
progress_bar.update(1)
182180
return -elbo_val
183181

184182
result = minimize(

0 commit comments

Comments
 (0)