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

Add top level functions and simplify accessors #25

Open
OriolAbril opened this issue Sep 28, 2024 · 1 comment
Open

Add top level functions and simplify accessors #25

OriolAbril opened this issue Sep 28, 2024 · 1 comment

Comments

@OriolAbril
Copy link
Member

I think we should continue to have arviz_stats.xyz available for all functions. The functions will continue to be implemented as DataArray level, and accessors should continue to be available, but I think the main thing exposed to the users should be the arviz_stats.xyz functions.

  • The main reason for this is there are functions that can only work by taking the whole InferenceData because they need data from multiple groups
  • secondly, we should support more than dataarray/dataset/datatree as inputs whenever possible, we could look into accepting arrays and dispatching to array_stats class instead of dataarray_stats one (though they have quite different APIs so not sure) but the key thing we should support are xarray groupby objects
  • third, this will allow defining all 3 accessors once, with all the methods using *args, **kwargs and changing only the self._apply method (already implemented in all of them)
  • fourth, this also clarifies where things should be documented, in the arviz_stats.xyz function. The accessors will not have the same signature (and only the datatree one would be able to either way) but it should be possible to have them pull the docstring from the top level function and remove the arguments that no longer make sense (i.e. group only makes sense for DataTree and var_names+filter_vars only makes sense for DataTree or Dataset)
@amaloney
Copy link

Huge fan of the accessor route.

@OriolAbril OriolAbril moved this to Planned in CZI Round 4 Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Planned
Development

No branches or pull requests

2 participants