Skip to content

Commit

Permalink
unique modus and save less for learn_error_params
Browse files Browse the repository at this point in the history
  • Loading branch information
LaraFuhrmann committed Nov 28, 2024
1 parent 822f341 commit 06f239b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions viloca/local_haplotype_inference/learn_error_params/cavi.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def run_cavi(
converged = False
elbo = 0
state_curr_dict = state_init_dict
k = 0
while converged is False:
min_number_iterations = 10
while (converged is False) or (iter < min_number_iterations):

if iter <= 1:
digamma_alpha_sum = digamma(state_curr_dict["alpha"].sum(axis=0))
Expand Down Expand Up @@ -160,7 +160,7 @@ def run_cavi(
state_init_dict,
state_curr_dict,
)

if iter % 2 == 0:
history_elbo.append(elbo)
history_mean_log_pi.append(state_curr_dict["mean_log_pi"])
Expand All @@ -184,11 +184,11 @@ def run_cavi(
break
elif np.abs(elbo - history_elbo[-2]) < 1e-03:
converged = True
k += 1
iter += 1
message = "ELBO converged."
exitflag = 0
else:
k = 0
iter = 0

# if k%10==0: # every 10th parameter set is saved to history
state_curr_dict.update({"elbo": elbo})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def gzip_file(f_name):
return f_out.name


def main(freads_in, fref_in, output_dir, n_starts, K, alpha0, alphabet="ACGT-", unique_modus=False):
def main(freads_in, fref_in, output_dir, n_starts, K, alpha0, alphabet="ACGT-", unique_modus=True):

window_id = freads_in.split("/")[-1][:-4] # freads_in is absolute path

Expand Down

0 comments on commit 06f239b

Please sign in to comment.