InferringIntention/keyboard_and_mouse/stan/strategy_inference_model.stan

27 lines
780 B
Text
Raw Normal View History

2024-03-24 23:42:27 +01:00
data {
int<lower=1> I; // number of question options (22)
int<lower=0> N; // number of questions being asked by the user
int<lower=1> K; // number of strategies
// observed "true" questions of the user
int q[N];
// array of predicted probabilities of questions given strategies
// coming from the forward neural network
matrix[I, K] P_q_S[N];
}
parameters {
// probabiliy vector of the strategies being applied by the user
// to be inferred by the model here
simplex[K] P_S;
}
model {
for (n in 1:N) {
// marginal probability vector of the questions being asked
vector[I] theta = P_q_S[n] * P_S;
// categorical likelihood
target += categorical_lpmf(q[n] | theta);
}
// priors
target += dirichlet_lpdf(P_S | rep_vector(1.0, K));
}