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

[minor] Memory efficient float32 types instead of float64 types #1402

Merged
merged 13 commits into from
Aug 21, 2023

Conversation

leoniewgnr
Copy link
Collaborator

@leoniewgnr leoniewgnr commented Aug 15, 2023

🔬 Background

The whole computation was done with float64 types, but torch tensors are float32 anyway and most of the ML models use float32 values. This will affect model accuracy but I think its worth it because we safe a lot of memory!

🔮 Key changes

  • y and yhat values: float32 if float32 is inserted, float64 if float64 is inserted
  • time values: will always be float64 because np.datetime64
  • feature values (events): float32

@github-actions
Copy link

github-actions bot commented Aug 15, 2023

Model Benchmark

Benchmark Metric main current diff
YosemiteTemps MAE_val 1.3442 1.34899 0.36%
YosemiteTemps RMSE_val 2.00245 2.00817 0.29%
YosemiteTemps Loss_val 0.00077 0.00078 0.58%
YosemiteTemps MAE 1.3192 1.32133 0.16%
YosemiteTemps RMSE 2.13518 2.13713 0.09%
YosemiteTemps Loss 0.00064 0.00064 0.17%
YosemiteTemps time 56.0812 56.22 0.25%
PeytonManning MAE_val 0.58159 0.58162 0.0%
PeytonManning RMSE_val 0.72216 0.72218 0.0%
PeytonManning Loss_val 0.01239 0.01239 0.01%
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 12.3043 12.12 -1.5%
AirPassengers MAE_val 13.0626 13.0627 0.0%
AirPassengers RMSE_val 15.9453 15.9453 0.0%
AirPassengers Loss_val 0.00131 0.00131 0.0%
AirPassengers MAE 9.88156 9.88153 -0.0%
AirPassengers RMSE 11.7354 11.7354 -0.0%
AirPassengers Loss 0.00052 0.00052 -0.0%
AirPassengers time 5.18 5.12 -1.16%
Model training plots

Model Training

PeytonManning

YosemiteTemps

AirPassengers

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #1402 (b3b5b36) into main (d236471) will increase coverage by 0.02%.
The diff coverage is 92.30%.

@@            Coverage Diff             @@
##             main    #1402      +/-   ##
==========================================
+ Coverage   89.85%   89.87%   +0.02%     
==========================================
  Files          38       38              
  Lines        5068     5069       +1     
==========================================
+ Hits         4554     4556       +2     
+ Misses        514      513       -1     
Files Changed Coverage Δ
neuralprophet/time_dataset.py 95.58% <85.71%> (+0.04%) ⬆️
neuralprophet/data/process.py 93.88% <100.00%> (ø)
neuralprophet/df_utils.py 94.65% <100.00%> (+0.14%) ⬆️

@leoniewgnr leoniewgnr self-assigned this Aug 15, 2023
@leoniewgnr leoniewgnr changed the title [minor] Memory efficient types [minor] Memory efficient float32 types instead of float64 types Aug 17, 2023
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This line is unnecessary as they will be converted to datetime the line below

@leoniewgnr leoniewgnr marked this pull request as ready for review August 17, 2023 17:53
@leoniewgnr leoniewgnr added the status: needs review PR needs to be reviewed by Reviewer(s) label Aug 17, 2023
@leoniewgnr leoniewgnr added status: in development Pull requests which are in development and removed status: needs review PR needs to be reviewed by Reviewer(s) labels Aug 17, 2023
@leoniewgnr leoniewgnr added status: needs review PR needs to be reviewed by Reviewer(s) and removed status: in development Pull requests which are in development labels Aug 17, 2023
@noxan noxan self-requested a review August 18, 2023 07:55
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

@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 Aug 20, 2023
@leoniewgnr leoniewgnr merged commit 596c3ee into main Aug 21, 2023
14 checks passed
@leoniewgnr leoniewgnr deleted the memory-efficient-type-conversion branch August 21, 2023 17:20
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.

2 participants