Skip to content

Commit

Permalink
Eliminate redundant calculations after incrementing
Browse files Browse the repository at this point in the history
  • Loading branch information
pdpiech committed May 23, 2016
1 parent 63cb260 commit 34390ba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions prefpy/evbwie1.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def aggregate(self, rankings, K, epsilon, tot_iters, epsilon_mm, max_iters_em):
pi_h = np.copy(pi_h0)

inner = tot_iters // max_iters_em
isIncremented = False

for g in range(max_iters_em):
#for g in range(max_iters):
Expand All @@ -110,9 +111,11 @@ def aggregate(self, rankings, K, epsilon, tot_iters, epsilon_mm, max_iters_em):
z_h1[i][k] = (pi_h[k] * EMMMixPLAggregator.f(x[i], p_h[k])) / denom_sum

# M-Step:
test = (g + 1) * inner + (max_iters_em - g - 1) * (inner + 1)
if test < tot_iters:
inner += 1
if not isIncremented:
test = (g + 1) * inner + (max_iters_em - g - 1) * (inner + 1)
if test < tot_iters:
inner += 1
isIncremented = True
for l in range(inner):
#for l in range(max_iters_mm):
#for l in range(int(g/50) + 5):
Expand Down

0 comments on commit 34390ba

Please sign in to comment.