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

[feature] Plot components of averaged df (and quants) if multiple IDs, but no df_name specified in plot_components() #888

Merged
merged 53 commits into from
Nov 27, 2022

Conversation

judussoari
Copy link
Collaborator

@judussoari judussoari commented Oct 21, 2022

Closes #866

To Do:

  • Add mean plot of components across all dfs
  • Add Standard Deviation to plot of averaged df components (as a shade in both directions)
  • Migrate the code to plot_parameters() instead of plot_cmponents, makes more sense

Before: We raised an Exception whenever multiple time series were present in the input df and plot_paramenters() was called without specifying the time series to be plotted.
Now: plots mean and quants of all time series when time series is not specified in df_name.

Sceenshot 1: model parameters when df_name is specified.
Sceenshot 2: model parameters when df_name is not specified.
Bildschirmfoto 2022-11-21 um 23 48 06
Bildschirmfoto 2022-11-21 um 23 47 55

…ied in plot_components()

*Use received_single_time_series and df_name as indicators

*Adjust integration and uncertainy tests - no raise of Exception anymore

*Changed former Errors to warnings in this special case

* matplotlib and plotly
@judussoari judussoari added this to the Release 0.4.2 milestone Oct 21, 2022
@judussoari judussoari self-assigned this Oct 21, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2022

Codecov Report

Merging #888 (19ec697) into main (18e206b) will increase coverage by 0.61%.
The diff coverage is 97.77%.

@@            Coverage Diff             @@
##             main     #888      +/-   ##
==========================================
+ Coverage   89.19%   89.81%   +0.61%     
==========================================
  Files          18       18              
  Lines        4450     4632     +182     
==========================================
+ Hits         3969     4160     +191     
+ Misses        481      472       -9     
Impacted Files Coverage Δ
neuralprophet/forecaster.py 88.01% <50.00%> (+0.30%) ⬆️
neuralprophet/plot_forecast_plotly.py 87.59% <86.66%> (+0.53%) ⬆️
neuralprophet/plot_model_parameters_plotly.py 94.86% <99.02%> (+2.71%) ⬆️
neuralprophet/plot_model_parameters_matplotlib.py 90.74% <99.04%> (+3.84%) ⬆️

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

…ied in plot_components()

*Use received_single_time_series and df_name as indicators

*Adjust integration and uncertainy tests - no raise of Exception anymore

*Changed former Errors to warnings in this special case

* matplotlib and plotly
…ied in plot_components()

*Use received_single_time_series and df_name as indicators

*Adjust integration and uncertainy tests - no raise of Exception anymore

*Changed former Errors to warnings in this special case

* matplotlib and plotly
…ied in plot_components()

*Use received_single_time_series and df_name as indicators

*Adjust integration and uncertainy tests - no raise of Exception anymore

*Changed former Errors to warnings in this special case

* matplotlib and plotly
@judussoari judussoari changed the title [feature] Plot components of averaged df if multiple IDs, but no df_name specified in plot_components() [feature] Plot components of averaged df (and std) if multiple IDs, but no df_name specified in plot_components() Oct 21, 2022
judussoari and others added 18 commits October 23, 2022 10:57
…specified

*mean_std indicates whether multiple dfs have been passed, without specifying df_name

*plot mean and std across all dfs

*for plotly
…specified

*mean_std indicates whether multiple dfs have been passed, without specifying df_name

*plot mean and std across all dfs

*for matplotlib
…specified

*mean_std indicates whether multiple dfs have been passed, without specifying df_name

*plot mean and std across all dfs

*for matplotlib
…specified

*mean_std indicates whether multiple dfs have been passed, without specifying df_name

*plot mean and std across all dfs

*for matplotlib
* only if global df, and df_name not specified

* only for trend and seasonality

* Plotly
* only if global df, and df_name not specified

* only for trend and seasonality

* Matplotlib
* df_name

*global/local normalization

*glocal/global model with multiple IDs
@alfonsogarciadecorral
Copy link
Collaborator

HI @judussoari ! Really nice work, this is super useful!
I have a few comments, I will put them below.

Computation time. plotting parameters is talking long. But that is because of numpy on the .groupby().apply()

If you change:

            df_trend_std = df_trend.groupby("ds")[["trend"]].apply(lambda x: np.std(x))
            df_trend = df_trend.groupby("ds")[["trend"]].apply(lambda x: np.mean(x))

by:

            df_trend_std = df_trend.groupby("ds")[["trend"]].apply(lambda x: x.std())
            df_trend = df_trend.groupby("ds")[["trend"]].apply(lambda x: x.mean())

it is much faster.

@Kevin-Chen0 Kevin-Chen0 added this to the Release 0.5.0 milestone Nov 4, 2022
@judussoari judussoari added the status: ready PR is ready to be merged label Nov 7, 2022
@Kevin-Chen0
Copy link
Collaborator

@judussoari Can you resolve the merge conflicts? Thx

@Kevin-Chen0 Kevin-Chen0 added status: needs update PR has outstanding comment(s) or PR test(s) that need to be resolved and removed status: ready PR is ready to be merged labels Nov 22, 2022
# Conflicts:
#	neuralprophet/forecaster.py
#	neuralprophet/plot_forecast_plotly.py
#	neuralprophet/plot_model_parameters_matplotlib.py
#	neuralprophet/plot_model_parameters_plotly.py
@judussoari judussoari added status: needs review PR needs to be reviewed by Reviewer(s) and removed status: needs update PR has outstanding comment(s) or PR test(s) that need to be resolved labels Nov 22, 2022
@Kevin-Chen0
Copy link
Collaborator

@judussoari can you resolve the merge conflicts? Thanks.

@Kevin-Chen0 Kevin-Chen0 added status: needs update PR has outstanding comment(s) or PR test(s) that need to be resolved and removed status: needs review PR needs to be reviewed by Reviewer(s) labels Nov 23, 2022
# Conflicts:
#	neuralprophet/forecaster.py
#	neuralprophet/plot_model_parameters_matplotlib.py
#	neuralprophet/plot_model_parameters_plotly.py
#	tests/test_integration.py
#	tests/test_plotting.py
@judussoari judussoari added status: needs review PR needs to be reviewed by Reviewer(s) and removed status: needs update PR has outstanding comment(s) or PR test(s) that need to be resolved labels Nov 27, 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 merged commit fe1d759 into ourownstory:main Nov 27, 2022
@github-actions
Copy link

fe1d759

Model Benchmark

Show benchmark results
Benchmark Metric main current diff
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 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%
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%
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%

Model Training

PeytonManning

YosemiteTemps

AirPassengers

@judussoari judussoari deleted the comp_avg_global branch November 27, 2022 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs review PR needs to be reviewed by Reviewer(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] plot components of average and std dev of all dfs in global df, if df_name not specified
4 participants