Skip to content

Commit

Permalink
monitor recall: skip the first batch since the recall is exactly 'k'
Browse files Browse the repository at this point in the history
  • Loading branch information
dizcza committed Apr 23, 2021
1 parent 0ecd018 commit a76e8b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions assembly/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def assembly_similarity(self):
similarity[name] = pairwise_similarity(y_learned)
return similarity

def trial_finished(self, x_samples_learned):
def trial_finished(self, x_samples_learned, step):
"""
A sample is being learned callback.
Expand All @@ -272,12 +272,16 @@ def trial_finished(self, x_samples_learned):
A list of learned input vectors to recall. Each entry can be either
a single vector tensor (one incoming area) or a tuple of tensors
(multiple incoming areas).
step : int
The batch ID.
"""
self._update_convergence()
self._update_support()
self.ys_previous = self.ys_output.copy()
self.ys_output.clear()
self._update_recall(x_samples_learned)
if step != 0:
# skip the first batch since the recall is exactly 'k'
self._update_recall(x_samples_learned)

def epoch_finished(self):
"""
Expand Down
3 changes: 2 additions & 1 deletion assembly/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def simulate(self, x_samples):
else:
y_prev = y
timer.tick()
self.monitor.trial_finished(x_samples[:sample_count])
self.monitor.trial_finished(x_samples[:sample_count],
step=step)
self.model.normalize_weights()
self.monitor.epoch_finished()

Expand Down

0 comments on commit a76e8b1

Please sign in to comment.