Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address small tech debt to use a conditional instead of try/except for Python 3.7 support #934

Merged
merged 5 commits into from
Nov 22, 2022

Conversation

kapoor1992
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2022

Codecov Report

Merging #934 (cdc6e21) into main (169e0b3) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #934   +/-   ##
=======================================
  Coverage   87.68%   87.68%           
=======================================
  Files          17       17           
  Lines        4433     4433           
=======================================
  Hits         3887     3887           
  Misses        546      546           
Impacted Files Coverage Δ
neuralprophet/forecaster.py 87.97% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@noxan
Copy link
Collaborator

noxan commented Nov 8, 2022

Hi @kapoor1992 and many thanks for your contribution.

To me the two implementations are exactly the same and I got the impression the try catch with ImportError is a frequently seen pattern, e.g. [stack overflow]. Do you know of any other projects using the version check implementation? I'd prefer to follow the most common implementation unless there are any strong reasons for one over the other?

@noxan noxan self-requested a review November 8, 2022 19:21
@noxan noxan self-assigned this Nov 8, 2022
@kapoor1992
Copy link
Contributor Author

Hey @noxan! So, I found a lot more back-and-forth on this (even in your link) haha! The try/except pattern definitely follows the EAFP principle which is Pythonic in nature while the if/else pattern is deemed "safer" generally since you're checking first. Ultimately, I don't think either choice makes much of a difference here since we're not doing anything major other than picking an import. If you prefer try/except, then feel free to reject + close this PR :)

Copy link
Collaborator

@noxan noxan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for the second opinion @karl-richter :)

@noxan noxan added the status: ready PR is ready to be merged label Nov 18, 2022
Copy link
Collaborator

@Kevin-Chen0 Kevin-Chen0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Kevin-Chen0 Kevin-Chen0 added this to the Release 0.5.0 milestone Nov 22, 2022
@Kevin-Chen0 Kevin-Chen0 merged commit 135e8b1 into ourownstory:main Nov 22, 2022
@github-actions
Copy link

135e8b1

Model Benchmark

Benchmark Metric main current diff
AirPassengers MAE_val 15.2698 15.2698 0.0%
AirPassengers RMSE_val 19.4209 19.4209 0.0%
AirPassengers Loss_val 0.00195 0.00195 0.0%
AirPassengers RegLoss_val 0 0 0.0%
AirPassengers epoch 89 89 0.0%
AirPassengers MAE 9.82902 9.82902 0.0%
AirPassengers RMSE 11.7005 11.7005 0.0%
AirPassengers Loss 0.00056 0.00056 0.0%
AirPassengers RegLoss 0 0 0.0%
PeytonManning MAE_val 0.64636 0.64636 0.0%
PeytonManning RMSE_val 0.79276 0.79276 0.0%
PeytonManning Loss_val 0.01494 0.01494 0.0%
PeytonManning RegLoss_val 0 0 0.0%
PeytonManning epoch 37 37 0.0%
PeytonManning MAE 0.42701 0.42701 0.0%
PeytonManning RMSE 0.57032 0.57032 0.0%
PeytonManning Loss 0.00635 0.00635 0.0%
PeytonManning RegLoss 0 0 0.0%
YosemiteTemps MAE_val 1.72948 1.72949 0.0%
YosemiteTemps RMSE_val 2.27386 2.27386 0.0%
YosemiteTemps Loss_val 0.00096 0.00096 0.0%
YosemiteTemps RegLoss_val 0 0 0.0%
YosemiteTemps epoch 84 84 0.0%
YosemiteTemps MAE 1.45189 1.45189 0.0%
YosemiteTemps RMSE 2.16631 2.16631 0.0%
YosemiteTemps Loss 0.00066 0.00066 0.0%
YosemiteTemps RegLoss 0 0 0.0%

Model Training

PeytonManning

YosemiteTemps

AirPassengers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready PR is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants