-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add autocorrelation plot #153
base: main
Are you sure you want to change the base?
Add autocorrelation plot #153
Conversation
src/arviz_plots/plot_collection.py
Outdated
# def get_target(self, var_name, selection): | ||
# """Get the target that corresponds to the given variable and selection.""" | ||
# return subset_ds(self.get_viz(var_name), "plot", selection) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change this, focus on the plot
plot_collection : PlotCollection | ||
The plot collection containing the autocorrelation plots. | ||
""" | ||
dt = convert_to_dataset(dt, group="posterior") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dt = convert_to_dataset(dt, group="posterior") |
|
||
# Calculate autocorrelation from arviz_stats autocorr computation | ||
core_base = _CoreBase() | ||
acf_data = core_base.autocorr(distribution_array, axis=-1)[..., :max_lag] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If autocorr is not an accessor it should be, then you will be able to pass ds/da.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sir, you mentioned making autocorr work with xarray objects. Should I :
-Raise an issue in arviz_stats to modify autocorr for xarray support,
or
-Create a wrapper/accessor in autocorrplot.py locally?
n_plots, plots_per_var = process_facet_dims(pc_data, pc_kwargs["cols"]) | ||
|
||
# Set up figure size | ||
figsize = pc_kwargs.get("plot_grid_kws", {}).get("figsize", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can copy all the "if plot_collection is None" logic from other plots like plotdist
@aloctavodia sir, you mentioned making autocorr work with xarray objects. Should I : |
Arviz-stats already have accessors for a few functions like hdi, ess, etc. So that's the place to implement them. |
@suhaani-agarwal are you still working on this? |
yes, I am still working on this. I am stuck in some dimension related properties of the autocorr computation. |
Hello , @aloctavodia this is some progress on the code....I have added the computation using the autocorr accessor, still a lot of work is remaining. I have some doubts...
|
It is incorrect to do the looping manually. See for example https://github.com/arviz-devs/arviz-plots/blob/main/src/arviz_plots/plots/ecdfplot.py, |
This is in reference to Issue #2
Current State:
acf_data
is being computed correctly from autocorr function fromarviz-stats
, but there are warnings about missing selections inviz[autocorr]
-Warning: Selection (('chain', np.int64(0)), ('draw', np.int64(0)), ('lag', np.int64(0))) not found in viz[autocorr]
.This indicates a mismatch in the expected dimensions or coordinates in the
viz
dataset.I would greatly appreciate your review and guidance on any changes needed to address errors or improve the implementation.
📚 Documentation preview 📚: https://arviz-plots--153.org.readthedocs.build/en/153/