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

[refactor] Lighten forecaster.py #1255

Merged
merged 3 commits into from
Apr 12, 2023
Merged

[refactor] Lighten forecaster.py #1255

merged 3 commits into from
Apr 12, 2023

Conversation

LeonieFreisinger
Copy link
Collaborator

Linked to #1133

🔬 Background

Currently, the forecaster.py is very large and contains many functions. We would like to lighten the forecaster.py and move selected functions to other files

🔮 Key changes

  • Introduce 3 new files processing.py, splitting.py, transforming.py
  • Move functions from forecaster to one of the new files
  • adapt test_unit.py and test_integration.py, because they call the moved functions

🔮 Future Recommendations

In a next step, the input varaibles of the moved functions should be adapted. Currently, the full model is passed as an input argument. However, for most functions the actual needed input argument can be further narrowed down.

📋 Review Checklist

  • I have performed a self-review of my own code.
  • (not applicable) I have commented my code, added docstrings and data types to function definitions.
  • (not applicable) I have added pytests to check whether my feature / fix works.

Please make sure to follow our best practices in the Contributing guidelines.

@LeonieFreisinger LeonieFreisinger added the status: in development Pull requests which are in development label Apr 11, 2023
@LeonieFreisinger LeonieFreisinger added this to the Release 0.5.4 milestone Apr 11, 2023
@LeonieFreisinger LeonieFreisinger self-assigned this Apr 11, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2023

Codecov Report

Merging #1255 (a8c2ea9) into main (03726d3) will increase coverage by 0.10%.
The diff coverage is 92.71%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #1255      +/-   ##
==========================================
+ Coverage   89.56%   89.66%   +0.10%     
==========================================
  Files          35       38       +3     
  Lines        4830     4955     +125     
==========================================
+ Hits         4326     4443     +117     
- Misses        504      512       +8     
Impacted Files Coverage Δ
neuralprophet/data/splitting.py 90.42% <90.42%> (ø)
neuralprophet/data/processing.py 91.98% <91.98%> (ø)
neuralprophet/data/transforming.py 100.00% <100.00%> (ø)
neuralprophet/forecaster.py 87.06% <100.00%> (-1.43%) ⬇️

... and 9 files with indirect coverage changes

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

@LeonieFreisinger LeonieFreisinger requested a review from noxan April 12, 2023 01:54
@noxan noxan changed the title [minor] Lighten forecaster.py [refactor] Lighten forecaster.py Apr 12, 2023
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.

LGTM :)

Have you considered using the regular verb form e.g. split over the progressive splitting for the filenames? Would make it shorter, no hard feelings, just a personal preference to have it more compact.

@noxan noxan added status: ready PR is ready to be merged and removed status: in development Pull requests which are in development labels Apr 12, 2023
@LeonieFreisinger
Copy link
Collaborator Author

Nice suggestion, will adapt that.
Thanks for your review!

@LeonieFreisinger LeonieFreisinger merged commit 6583473 into main Apr 12, 2023
@LeonieFreisinger LeonieFreisinger deleted the lighten_forecaster branch April 12, 2023 23:46
@github-actions
Copy link

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 MAE 9.82902 9.82902 0.0%
AirPassengers RMSE 11.7005 11.7005 0.0%
AirPassengers Loss 0.00056 0.00056 0.0%
AirPassengers time 7.48551 7.42 -0.88%
YosemiteTemps MAE_val 1.71298 1.71298 0.0%
YosemiteTemps RMSE_val 2.26069 2.26069 0.0%
YosemiteTemps Loss_val 0.00095 0.00095 0.0%
YosemiteTemps MAE 1.45187 1.45187 0.0%
YosemiteTemps RMSE 2.16721 2.16721 0.0%
YosemiteTemps Loss 0.00066 0.00066 0.0%
YosemiteTemps time 170.072 166.76 -1.95%
PeytonManning MAE_val 0.58159 0.58159 0.0%
PeytonManning RMSE_val 0.72216 0.72216 0.0%
PeytonManning Loss_val 0.01239 0.01239 0.0%
PeytonManning MAE 0.41671 0.41671 0.0%
PeytonManning RMSE 0.55961 0.55961 0.0%
PeytonManning Loss 0.00612 0.00612 0.0%
PeytonManning time 21.8895 20.58 -5.98% 🎉
Model training plots

Model Training

PeytonManning

YosemiteTemps

AirPassengers

@noxan noxan modified the milestones: Release 0.6.0rc1, Release 0.6.0 Apr 17, 2023
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