Skip to content

Commit 17cc906

Browse files
committed
fix models
1 parent 93c14af commit 17cc906

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

knitr/bandits/bernoulli-ab.stan

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ model {
1111
}
1212
generated quantities {
1313
int<lower = 0, upper = 1> is_best[K];
14-
for (k in 1:K)
15-
is_best[k] = (theta[k] >= best_prob);
14+
{
15+
real best_prob = max(theta);
16+
for (k in 1:K) {
17+
is_best[k] = (theta[k] >= best_prob);
18+
}
19+
}
1620
}

knitr/car-iar-poisson/pois_icar.stan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ model {
2828
beta0 ~ normal(0.0, 1.0);
2929
beta1 ~ normal(0.0, 1.0);
3030
sigma ~ normal(0.0, 1.0);
31-
phi ~ icar_normal_lpdf(N, node1, node2);
31+
phi ~ icar_normal(N, node1, node2);
3232
// soft sum-to-zero constraint on phi
3333
// more efficient than mean(phi) ~ normal(0, 0.001)
3434
sum(phi) ~ normal(0, 0.001 * N);

knitr/neural-nets/nn.stan

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ model {
3939
to_vector(beta) ~ normal(0, 2);
4040

4141
// likelihood
42-
y[n] ~ categorical_logit(v[ , n]);
42+
for (n in 1:N)
43+
y[n] ~ categorical_logit(v[ , n]);
4344
}
4445

4546

0 commit comments

Comments
 (0)