You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I like to initialise a new fit with the results from a previous run which fails for models with nested array structures. The issue is that the nested array structure is not carried forward to the initials correctly.
To Reproduce
Example model (referred to as bernoulli-array.stan):
data {
int<lower=0> N;
array[N] int<lower=0,upper=1> y;
}
parameters {
array[1,1] real<lower=0,upper=1> theta;
}
model {
theta[1,1] ~beta(1,1); // uniform prior on interval 0,1
y ~bernoulli(theta[1,1]);
}
post2 <- ba$sample(list(N=20, y=rbinom(20, 1, 0.2)), refresh=250, init=post, seed = 4679453)
> Merging chains in order to subset via 'draw'.
Running MCMC with 4 sequential chains...
Chain 1 Unrecoverable error evaluating the log probability at the initial value.
Chain 1 Exception: mismatch in number dimensions declared and found in context; processing stage=parameter initialization; variable name=theta; dims declared=(1,1); dims found=() (in '/scratch/weberse2/tmp/RtmpZLNHUy/model-33207a2e2840a8.stan', line 6, column 2 to column 41)
Warning: Chain 1 finished unexpectedly!
Chain 2 Unrecoverable error evaluating the log probability at the initial value.
Chain 2 Exception: mismatch in number dimensions declared and found in context; processing stage=parameter initialization; variable name=theta; dims declared=(1,1); dims found=() (in '/scratch/weberse2/tmp/RtmpZLNHUy/model-33207a2e2840a8.stan', line 6, column 2 to column 41)
Warning: Chain 2 finished unexpectedly!
Chain 3 Unrecoverable error evaluating the log probability at the initial value.
Chain 3 Exception: mismatch in number dimensions declared and found in context; processing stage=parameter initialization; variable name=theta; dims declared=(1,1); dims found=() (in '/scratch/weberse2/tmp/RtmpZLNHUy/model-33207a2e2840a8.stan', line 6, column 2 to column 41)
Warning: Chain 3 finished unexpectedly!
Chain 4 Unrecoverable error evaluating the log probability at the initial value.
Chain 4 Exception: mismatch in number dimensions declared and found in context; processing stage=parameter initialization; variable name=theta; dims declared=(1,1); dims found=() (in '/scratch/weberse2/tmp/RtmpZLNHUy/model-33207a2e2840a8.stan', line 6, column 2 to column 41)
Warning: Chain 4 finished unexpectedly!
Warning: Use read_cmdstan_csv() to read the results of the failed chains.
Warning messages:
1: All chains finished unexpectedly! Use the $output(chain_id) method for more information.
2: No chains finished successfully. Unable to retrieve the fit.
Expected behavior
This should simply work.
Operating system
macOS Sequoia
CmdStanR version number
0.8.1
CmdStan: 2.34.1
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Have you tried installing the development version from GitHub? I'm pretty sure @SteveBronder already fixed this and I don't get any error running your example with the development version. That fix will be included in the next release, which will have to be soon in order to deal with #1066.
Thanks for looking into this and running the example. You are right - with the development version this works just fine.
I need to make it a habit to check with the dev version again. Also releasing more often cmdstanr is something to consider? Obviously that's work, but how about releasing with every other Stan release or so?
Relying on the development version is not really an option for most things I do, which is why more frequent releases are much appreciated.
@andrjohns Sounds good, thanks! I think everything else (including my PR to remove the deprecations) can wait for the following release (hopefully 1.0).
Describe the bug
I like to initialise a new fit with the results from a previous run which fails for models with nested array structures. The issue is that the nested array structure is not carried forward to the initials correctly.
To Reproduce
Example model (referred to as
bernoulli-array.stan
):The second fit fails for me with:
Expected behavior
This should simply work.
Operating system
macOS Sequoia
CmdStanR version number
0.8.1
CmdStan: 2.34.1
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: