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

Avoidance of duplicate code in regularisation #1110

Merged
merged 16 commits into from
Feb 8, 2023

Conversation

leoniewgnr
Copy link
Collaborator

@leoniewgnr leoniewgnr commented Jan 11, 2023

🔬 Background

As mentioned in issue #712, there is duplicate code regarding the event and holiday implementation.

🔮 Key changes

Two functions were edited to remove duplicate code:

  1. In the regularisation of events and holidays (def reg_func_events in utils.py) duplicate code was removed and put into a helper function.
  2. In construction of the event features (def make_events_features in time_dataset.py) duplicate code was removed and put into a helper function.

📋 Review Checklist

  • I have performed a self-review of my own code.
  • I have commented my code, added docstrings and data types to function definitions.
  • I have added pytests to check whether my feature / fix works. (I didn't add additional pytests, as it only was refactoring, but no existing pytest fails)

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2023

Codecov Report

Merging #1110 (b03b272) into main (55c23bb) will increase coverage by 0.02%.
The diff coverage is 100.00%.

📣 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    #1110      +/-   ##
==========================================
+ Coverage   90.17%   90.19%   +0.02%     
==========================================
  Files          30       30              
  Lines        4966     4958       -8     
==========================================
- Hits         4478     4472       -6     
+ Misses        488      486       -2     
Impacted Files Coverage Δ
neuralprophet/time_dataset.py 95.53% <100.00%> (+0.26%) ⬆️
neuralprophet/utils.py 81.36% <100.00%> (-0.12%) ⬇️
neuralprophet/np_types.py 100.00% <0.00%> (+8.33%) ⬆️

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

@leoniewgnr leoniewgnr marked this pull request as ready for review January 22, 2023 21:14
@LeonieFreisinger LeonieFreisinger self-requested a review January 25, 2023 18:33
neuralprophet/utils.py Outdated Show resolved Hide resolved
neuralprophet/time_dataset.py Outdated Show resolved Hide resolved
neuralprophet/time_dataset.py Outdated Show resolved Hide resolved
@leoniewgnr leoniewgnr linked an issue Jan 25, 2023 that may be closed by this pull request
@leoniewgnr
Copy link
Collaborator Author

@LeonieFreisinger, thanks for you feedback! I included it in the lates commits. But I don't know why Linters / isort and Linters / black keep failing.

  • Linters / isort: The order of inputs is exactly the same as in main
  • Linters / black: It tells me that it would reformat utils.py, but I let black run before committing and there were no changes in utils.py. In addition, it suggests reformatting in lines of code where I did not change anything

@leoniewgnr leoniewgnr added the status: needs review PR needs to be reviewed by Reviewer(s) label Feb 6, 2023
Copy link
Collaborator

@LeonieFreisinger LeonieFreisinger left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning up that part of the code!! I have added only two more comments. The rest is good to go.

neuralprophet/time_dataset.py Outdated Show resolved Hide resolved
neuralprophet/utils.py Outdated Show resolved Hide resolved
@judussoari judussoari added this to the Release 0.5.2 milestone Feb 8, 2023
@leoniewgnr leoniewgnr added status: ready PR is ready to be merged and removed status: needs review PR needs to be reviewed by Reviewer(s) labels Feb 8, 2023
@leoniewgnr leoniewgnr merged commit 7c051ff into ourownstory:main Feb 8, 2023
@github-actions
Copy link

github-actions bot commented Feb 8, 2023

Model Benchmark

Benchmark Metric main current diff
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 MAE 0.42701 0.42701 0.0%
PeytonManning RMSE 0.57032 0.57032 0.0%
PeytonManning Loss 0.00635 0.00635 0.0%
PeytonManning time 11.2491 11.57 2.85%
YosemiteTemps MAE_val 1.72949 1.72949 0.0%
YosemiteTemps RMSE_val 2.27386 2.27386 0.0%
YosemiteTemps Loss_val 0.00096 0.00096 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 time 91.1 91.74 0.7%
AirPassengers MAE_val 15.2698 15.4077 0.9%
AirPassengers RMSE_val 19.4209 19.5099 0.46%
AirPassengers Loss_val 0.00195 0.00196 0.92%
AirPassengers MAE 9.82902 9.86947 0.41%
AirPassengers RMSE 11.7005 11.7222 0.19%
AirPassengers Loss 0.00056 0.00057 2.1%
AirPassengers time 4.00467 4.06 1.38%
Model training plots

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.

Harmonize internal event and holiday implementation
7 participants