Skip to content

Commit

Permalink
Fixed bug where affinity matrix was not always correctly symmetrized …
Browse files Browse the repository at this point in the history
…in sweeps. Also added plotting utility module. Updated callback tolerances to be more conservative. Implemented kEff calculators.
  • Loading branch information
ejohnson643 committed Oct 28, 2021
1 parent 017d06f commit ffb7073
Show file tree
Hide file tree
Showing 6 changed files with 713 additions and 223 deletions.
18 changes: 17 additions & 1 deletion EMBEDR/_affinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,20 @@ def GaussianAff_fromPrec(distances,
return P



@jit(nopython=True)
def calculate_kEff(P, row_idx, alpha_nu=0.02):

kEff_arr = np.zeros_like(row_idx)[:-1]

for ii in range(len(kEff_arr)):
## Find the max value in the row.
P_row_max = -1
for jj in range(row_idx[ii], row_idx[ii + 1]):
if P[jj] > P_row_max:
P_row_max = P[jj]
## Count the number larger
for jj in range(row_idx[ii], row_idx[ii + 1]):
if P[jj] > (P_row_max * alpha_nu):
kEff_arr[ii] += 1

return kEff_arr
2 changes: 1 addition & 1 deletion EMBEDR/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class QuitNoExaggerationPhase(Callback):
gradient descent when the relative changes in DKL are less than a
specified tolerance.
"""
def __init__(self, rel_err_tol=1.e-5, min_iter=250, verbose=False):
def __init__(self, rel_err_tol=1.e-6, min_iter=250, verbose=False):
self.iter_count = 0
self.last_log_time = None
self.init_DKL = -1.0
Expand Down
Loading

0 comments on commit ffb7073

Please sign in to comment.