Skip to content

Commit

Permalink
stan demos
Browse files Browse the repository at this point in the history
  • Loading branch information
Jachym.Barvinek committed Aug 3, 2024
1 parent d7a67e7 commit 0223d24
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions assets/stan_demos/ar_k.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
int<lower=0> K; // model order
int<lower=0> N; // dataset size
int<lower=1> K; // model order
int<lower=K+1> N; // dataset size
vector[N] y;
}
parameters {
Expand Down
3 changes: 2 additions & 1 deletion assets/stan_demos/ar_k_fa.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
data {
int<lower=0> N, K;
int<lower=1> K; // model order
int<lower=K+1> N; // dataset size
array[N] int<lower=0,upper=1> free;
vector[N] y;
}
Expand Down
6 changes: 3 additions & 3 deletions assets/stan_demos/imdb.stan
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
data {
int N; // num products
array[N, 5] int ratings;
int<lower=1> N; // num products
array[N, 5] int<lower=0> ratings;
}
parameters {
vector<lower=0>[5] alpha;
array[N] simplex[5] d;
}
model {
d ~ dirichlet(alpha);
d ~ dirichlet(alpha); // for all d[i]
for (i in 1:N) {
ratings[i] ~ multinomial(d[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/imdb_inference.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
vector<lower=0>[5] alpha;
array[5] int rating;
array[5] int<lower=0> rating;
}
parameters {
simplex[5] d;
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/inhomogeneous_poisson_process.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data {
int<lower=0> N; // Number of observed events
int<lower=1> N; // Number of observed events
real<lower=0> T; // End of observation interval
vector<lower=0, upper=T>[N] t; // Times of events
}
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/lasso_multivariate.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
int<lower=1> K;
int<lower=0> N;
int<lower=0> K;
matrix[N, K] x;
vector[N] y;
real<lower=0> lambda;
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/mlp.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data {
int<lower=0> M, N, K;
int<lower=1> M, N, K;
matrix[M, N] x;
array[M] int<lower=0,upper=1> y;
}
Expand Down
4 changes: 2 additions & 2 deletions assets/stan_demos/ols_multivariate.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
int<lower=0> N;
int<lower=0> K;
int<lower=1> K;
int<lower=K+1> N;
matrix[N, K] x;
vector[N] y;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/ols_univariate.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data {
int<lower=0> N;
int<lower=2> N;
vector[N] x;
vector[N] y;
}
Expand Down
4 changes: 2 additions & 2 deletions assets/stan_demos/poisson_glm.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
int<lower=0> N;
int<lower=0> K;
int<lower=1> N;
int<lower=1> K;
array[N] int<lower=0> y;
matrix[N, K] x; // features
}
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/ridge_multivariate.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
int<lower=1> K;
int<lower=0> N;
int<lower=0> K;
matrix[N, K] x;
vector[N] y;
real<lower=0> lambda;
Expand Down
6 changes: 3 additions & 3 deletions assets/stan_demos/trivial_learning.stan
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
data {
int N;
array[N] int<lower=0> x;
int<lower=1> N; // num samples
array[N] int<lower=0> x; // data
}
parameters {
real<lower=0> lambda;
real<lower=0> lambda; // to learn
}
model {
x ~ poisson(lambda);
Expand Down
2 changes: 1 addition & 1 deletion assets/stan_demos/trivial_learning_custom.stan
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ functions {
}
}
data {
int N;
int<lower=1> N;
array[N] int<lower=0> x;
}
parameters {
Expand Down

0 comments on commit 0223d24

Please sign in to comment.