feat: add plot_ts for time series visualization (closes #322)#439
Conversation
5b6ba3d to
63cf15a
Compare
|
@jinukuntlaakhilakumargoud-web, usually, if you see that another person says they are working on an issue, you should not work on that issue. |
|
@rohanbabbar04 can you check this? |
|
@aloctavodia Ah, I sincerely apologize! I am still getting used to the open-source workflow and completely missed that @rohanbabbar04 had already claimed issue #322 before I started. That is entirely my fault. @rohanbabbar04 I didn't mean to step on your toes. Since I already pushed this up, please feel completely free to use my branch as a starting point, review this PR, or if you prefer to build it from scratch yourself, just let me know and I will close this PR! Whatever works best for you. |
|
@jinukuntlaakhilakumargoud-web for future reference: https://python.arviz.org/en/latest/contributing/contributing_prs.html#steps-before-starting-work (most relevant piece quoted below)
|
Yeah, I can check this |
Summary
Implements
plot_ts- a new time series plot (issue #322). This adds parity with the legacyarviz.plot_tsfunction using the new modularPlotCollection-based architecture, following the pattern established byplot_lm.New file:
src/arviz_plots/plots/ts_plot.pyVisual elements
observed_lineline_xyposterior_predictiveline_xyobserved_scatterscatter_xyforecastline_xyvlinevlinexlabel/ylabellabelled_x/yKey parameters
y,x- pre-holdout observed variable and time axisy_hat- posterior predictive variable for in-sample trajectoriesy_holdout,y_forecasts- holdout observed and forecast variablesnum_samples- number of PP sample lines to draw (default 50)sample_dims,coords,filter_vars,visuals,aes_by_visuals,**pc_kwargs- standard ArviZ-plots patternImplementation notes
ppc_dist_plotpattern for PP samples: stackssample_dimsinto a flatsampledimension and usesoverlay_ppcaesthetic_combine_xyhelper (similar tocombine_sort_smoothinplot_lm) to buildplot_axis-shaped datasets forline_xy/scatter_xyyvariable names forPlotCollection.map()alignmentTests:
tests/test_ts_plot.py7 tests covering:
y_hat)y_holdout)y_forecasts)visuals={"observed_line": False})plot_dim)pytest tests/test_ts_plot.py -k none # 7 passed