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

Proposal objects retain information about dimension first run with #51

Open
matt-graham opened this issue Dec 4, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@matt-graham
Copy link
Collaborator

Some target distributions and so proposals can be defined in a dimension independent way, for example

target_distribution <- list(
  log_density = function(x) -sum(x^2) / 2,
  gradient_log_density = function(x) -x
)
proposal <- barker_proposal(target_distribution)

As the proposal object stores a shape parameter which is dimension dependent however, once the proposal is used to sample a chain with shape adaptation for a certain dimension, a subsequent attempt to use the same proposal with a different dimension gives a cryptic error -

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'drop': non-conformable arguments

which arises when attempting to evaluate product of vector with shape parameter from previous run (which is of incompatible dimension).

We may not want to support this use case of reusing the same proposal objects for different dimension, but ideally we should give a more informative error message in these situations.

@matt-graham matt-graham added the enhancement New feature or request label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant