Skip to content

Commit

Permalink
fix: added optimal acceptance time recording to results
Browse files Browse the repository at this point in the history
  • Loading branch information
mwong009 committed Jul 9, 2024
1 parent fa2177d commit 3a87063
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pycmtensor/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self):
"""
self.build_time = None
self.train_time = None
self.accept_time = None
self.epochs_per_sec = None
self.n_params = None
self.n_train = None
Expand Down Expand Up @@ -145,6 +146,7 @@ def benchmark(self):
stats.loc["Seed"] = self.config.seed
stats.loc["Model build time"] = self.build_time
stats.loc["Model train time"] = self.train_time
stats.loc["Optimal train time"] = self.accept_time
stats.loc["epochs per sec"] = f"{self.epochs_per_sec} epoch/s"
return stats

Expand Down
4 changes: 4 additions & 0 deletions pycmtensor/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ def accept_condition(model, i, ll, error):
max_patience = max(model.patience, i * model.config.patience_increase)
model.patience = int(min(max_patience, model.config.max_iterations))

now = perf_counter()
accept_time = round(now - model.results.start_time, 3)
model.results.accept_time = time_format(accept_time)

return accept


Expand Down

0 comments on commit 3a87063

Please sign in to comment.