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] Add static plotly backend #1286

Merged
merged 15 commits into from
Apr 27, 2023
Merged

Conversation

hxyue1
Copy link
Collaborator

@hxyue1 hxyue1 commented Apr 19, 2023

🔬 Background

This mostly resolves #1235. I'm not sure how to proceed with plots for the conformal class since it has a different implementation.

🔮 Key changes

Adds argument that allows users to select a static display type. If this is specified, it sets the backend to plotly and then displays the plot in the specified type. The interactive plot is still returned from the function call.

📋 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.

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

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2023

Codecov Report

Merging #1286 (31efd54) into main (9f08ff6) will increase coverage by 0.01%.
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    #1286      +/-   ##
==========================================
+ Coverage   89.82%   89.84%   +0.01%     
==========================================
  Files          38       38              
  Lines        5142     5149       +7     
==========================================
+ Hits         4619     4626       +7     
  Misses        523      523              
Impacted Files Coverage Δ
neuralprophet/plot_model_parameters_plotly.py 94.95% <ø> (ø)
neuralprophet/forecaster.py 87.42% <100.00%> (+0.06%) ⬆️
neuralprophet/plot_forecast_plotly.py 87.30% <100.00%> (+0.19%) ⬆️

@ourownstory ourownstory added this to the Release 0.6.0 milestone Apr 19, 2023
@LeonieFreisinger LeonieFreisinger added the status: needs review PR needs to be reviewed by Reviewer(s) label Apr 21, 2023
@@ -339,6 +347,8 @@ def plot_components(
for ax in multiplicative_axes:
ax = set_y_as_percent(ax)
unregister_plotly_resampler()
if plotly_static:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@hxyue1 I am wondering, if in the 'plotly_static' case, we will display the figure twice if calling another .show() when applying the plot function?

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.

Hey @hxyue1! Thanks a lot for your work in this PR. Looks generally good to me. :)
3 points to touch upon:

  • if we call a fig.show() in the 'plotly_static' case and return the fig, do we run in a problem of plotting it twice with this function call.
  • can you edit the test_plot() in the test_plotting.py with testing the 'plotly_static' ? I think it would be good the have it checked via at least one test. Editing all tests would be a little much. Would be great to also add the plotly_resampler on that go
  • Can as well adjust the plotly tutorial with the update of the plotly_static backend?

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.

Great work! Thanks for keeping up with it

@LeonieFreisinger
Copy link
Collaborator

@hxyue1 please have a final look at resolving the merge conflict. Afterwards, feel free to merge.

@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 Apr 27, 2023
@leoniewgnr leoniewgnr merged commit bc6891f into ourownstory:main Apr 27, 2023
@github-actions
Copy link

Model Benchmark

Benchmark Metric main current diff
AirPassengers MAE_val 13.0626 13.0626 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.88156 0.0%
AirPassengers RMSE 11.7354 11.7354 0.0%
AirPassengers Loss 0.00052 0.00052 0.0%
AirPassengers time 5.10729 4.92 -3.67%
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 12.6337 12 -5.02% 🎉
YosemiteTemps MAE_val 1.3442 1.3442 0.0%
YosemiteTemps RMSE_val 2.00245 2.00245 0.0%
YosemiteTemps Loss_val 0.00077 0.00077 0.0%
YosemiteTemps MAE 1.3192 1.3192 0.0%
YosemiteTemps RMSE 2.13518 2.13518 0.0%
YosemiteTemps Loss 0.00064 0.00064 0.0%
YosemiteTemps time 67.236 61.32 -8.8% 🎉
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.

Add plotly-static plotting backend
5 participants