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

Applying a function to each chain #353

Open
n-kall opened this issue Mar 11, 2024 · 1 comment
Open

Applying a function to each chain #353

n-kall opened this issue Mar 11, 2024 · 1 comment

Comments

@n-kall
Copy link
Collaborator

n-kall commented Mar 11, 2024

Are there simple ways (can be internal functions) to apply a function to each chain of a draws or rvar object?

For a draws object, I can do:

example_draws() |>
  extract_variable_matrix("mu") |>
  apply(MARGIN = 2, FUN = ess_bulk)

But the equivalent for an rvar is not immediately clear to me.

This is related to the automatic thinning via ess, which uses this method but if rvars become the default for summarise draws (#184 ), will need to be updated.

@mjskay
Copy link
Collaborator

mjskay commented Mar 11, 2024

I would do draws_of(x, with_chains = TRUE) then use apply()

It's a good question if we should export something - my thinking so far has been to keep that stuff internal unless/until a good internal API for it solidifies from repeated experience, then think about exporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants