Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ourownstory committed Aug 13, 2024
1 parent 687b6d8 commit f796efa
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions neuralprophet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,16 @@ def smooth_loss_and_suggest(lr_finder, window=10):
"samples or manually set the learning rate."
)
raise
lr_suggestion_default = lr_finder.suggestion(skip_begin=10, skip_end=3)
if suggestion is not None and suggestion is not None:
lr_suggestion = np.exp(0.5 * np.log(suggestion) + 0.5 * np.log(lr_suggestion_default))
suggestion_default = lr_finder.suggestion(skip_begin=10, skip_end=3)
if suggestion is not None and suggestion_default is not None:
log_suggestion_smooth = np.log(suggestion)
log_suggestion_default = np.log(suggestion_default)
lr_suggestion = np.exp((log_suggestion_smooth + log_suggestion_default) / 2)
elif suggestion is None and suggestion_default is None:
log.error(f"Automatic learning rate test failed. Please set manually the learning rate.")

Check failure on line 809 in neuralprophet/utils.py

View workflow job for this annotation

GitHub Actions / flake8

f-string is missing placeholders
raise
else:
lr_suggestion = suggestion if suggestion is not None else lr_suggestion_default
lr_suggestion = suggestion if suggestion is not None else suggestion_default
return (loss, lr, lr_suggestion)


Expand Down

0 comments on commit f796efa

Please sign in to comment.