data{
int <lower=0> J; // number of components in the pool
int <lower=0> K; // K interaction
matrix[K, J] prior_activity;
matrix[K, J] prior_qed;
matrix[K, J] prior_sa;
matrix[K, J] observed_activity; // observed activity scores
matrix[K, J] observed_qed; // observed qed scores
matrix[K, J] observed_sa; // observed sa scores
int prior_choice[K];
int <lower=0> advice [K];
int <lower=0, upper=1> decision[K];
}
parameters{
simplex[3] w; // weights for activity, qed, sa
real<lower=1,upper=4> beta1; // bias parameter in prior knowledge
real<lower=10,upper=40> beta2; // bias parameter in prior knowledge
}
model{
real advantage[K];
row_vector[J] observed_scores;
matrix[K, J] prior_prob;
row_vector[J] prior_scores;
w ~ normal(.5, .15);
beta1~uniform(1,4);
beta2~uniform(10,40);
for (i in 1:K){
prior_scores=w[1]* prior_activity[i]+ w[2]*prior_qed[i] + w[3]* prior_sa[i];
prior_prob[i]=to_row_vector(softmax(to_vector(prior_scores*beta1)));
prior_choice[i] ~ categorical(to_vector(prior_prob[i]));
observed_scores= w[1]*observed_activity[i]+w[2]*observed_qed[i]+ w[3]*observed_sa[i];
advantage[i]=observed_scores[advice[i]]- observed_scores[prior_choice[i]];
decision~bernoulli_logit(beta2*advantage[i]);
}
}
Hi, I use stan to model prior_choice and use prior_choice to compute an advantage score to model the decision.
When my input is the following data, stan warns me many times like Rejecting initial value: Log probability evaluates to log(0), i.e. negative infinity. Stan can’t start sampling from this initial value.
advice and prior choice are int values range from [1,19]. decision is binary value.
activity, qed, sa are some values from [0,1] if normal. and sometimes -10000, if those elements don’t want to be considered in softmax.
Not sure where does this warning comes from? Could someone help me identify the problem?
advice [2, 10, 2, 14, 1]
prior_choice [12, 1, 17, 4, 11]
decision [0, 1, 1, 0, 1]
INFO:stan_model:prior_activity [[0.123, 0.3615, 0.1313, 0.1497, 0.1328, 0.1043, 0.1269, 0.1364, 0.0956, 0.1493, 0.1204, -10000, 0.1207, 0.1292, 0.1306, 0.1351, 0.1171, 0.0989, 0.1227], [0.123, 0.3615, 0.1313, 0.1497, 0.1328, 0.1043, 0.1269, 0.1364, 0.0956, 0.1493, 0.1204, -10000, -10000, 0.1292, 0.1306, 0.1351, 0.1171, 0.0989, 0.1227], [0.123, -10000, 0.1313, 0.1497, 0.1328, 0.1043, 0.1269, 0.1364, 0.0956, 0.1493, 0.1204, -10000, -10000, 0.1292, 0.1306, 0.1351, 0.1171, 0.0989, 0.1227], [0.123, -10000, 0.1313, 0.1497, 0.1328, 0.1043, 0.1269, 0.1364, 0.0956, 0.1493, 0.1204, -10000, -10000, 0.1292, 0.1306, 0.1351, 0.1171, -10000, 0.1227], [0.123, -10000, 0.1313, 0.1497, -10000, 0.1043, 0.1269, 0.1364, 0.0956, 0.1493, 0.1204, -10000, -10000, 0.1292, 0.1306, 0.1351, 0.1171, -10000, 0.1227]]
INFO:stan_model:prior_qed [[0.5525, 0.71051, 0.5866, 0.5904, 0.5695, 0.5441, 0.606, 0.6002, 0.556, 0.5871, 0.5707, -10000, 0.6395, 0.4863, 0.6771, 0.622, 0.5465, 0.5884, 0.6494], [0.5525, 0.71051, 0.5866, 0.5904, 0.5695, 0.5441, 0.606, 0.6002, 0.556, 0.5871, 0.5707, -10000, -10000, 0.4863, 0.6771, 0.622, 0.5465, 0.5884, 0.6494], [0.5525, -10000, 0.5866, 0.5904, 0.5695, 0.5441, 0.606, 0.6002, 0.556, 0.5871, 0.5707, -10000, -10000, 0.4863, 0.6771, 0.622, 0.5465, 0.5884, 0.6494], [0.5525, -10000, 0.5866, 0.5904, 0.5695, 0.5441, 0.606, 0.6002, 0.556, 0.5871, 0.5707, -10000, -10000, 0.4863, 0.6771, 0.622, 0.5465, -10000, 0.6494], [0.5525, -10000, 0.5866, 0.5904, -10000, 0.5441, 0.606, 0.6002, 0.556, 0.5871, 0.5707, -10000, -10000, 0.4863, 0.6771, 0.622, 0.5465, -10000, 0.6494]]
INFO:stan_model:prior_sa [[0.7265, 0.7505, 0.7998, 0.7276, 0.7117, 0.7241, 0.7381, 0.7459, 0.7513, 0.7536, 0.7499, -10000, 0.7716, 0.7087, 0.7634, 0.7344, 0.7525, 0.7953, 0.763], [0.7265, 0.7505, 0.7998, 0.7276, 0.7117, 0.7241, 0.7381, 0.7459, 0.7513, 0.7536, 0.7499, -10000, -10000, 0.7087, 0.7634, 0.7344, 0.7525, 0.7953, 0.763], [0.7265, -10000, 0.7998, 0.7276, 0.7117, 0.7241, 0.7381, 0.7459, 0.7513, 0.7536, 0.7499, -10000, -10000, 0.7087, 0.7634, 0.7344, 0.7525, 0.7953, 0.763], [0.7265, -10000, 0.7998, 0.7276, 0.7117, 0.7241, 0.7381, 0.7459, 0.7513, 0.7536, 0.7499, -10000, -10000, 0.7087, 0.7634, 0.7344, 0.7525, -10000, 0.763], [0.7265, -10000, 0.7998, 0.7276, -10000, 0.7241, 0.7381, 0.7459, 0.7513, 0.7536, 0.7499, -10000, -10000, 0.7087, 0.7634, 0.7344, 0.7525, -10000, 0.763]]
INFO:stan_model:observed_activity [[0.43361595, 0.5412475999999999, 0.39778534, 0.41658420000000007, 0.431883, 0.3849979, 0.4401906, 0.3994844, 0.38618642, 0.42931145, 0.44220832, 0.37760597, 0.40562266, 0.42212537, 0.40489978, 0.43529284, 0.41954756, 0.38906599999999997, 0.39948127], [0.35191864, 0.41545699999999997, 0.34320527, 0.31275457, 0.34292608, 0.34499025, 0.33712748, 0.34781212, 0.33666766, 0.36987470000000006, 0.34742272, -10000, 0.36603457, 0.35749662, 0.34646735, 0.3479908, 0.35067677, 0.3367098, 0.34678459999999994], [0.45803228, 0.52903056, 0.44052398, 0.4150692, 0.45309168, 0.45181686, 0.4339355, 0.44762427, 0.41756523, -10000, 0.43208274, -10000, 0.43864167, 0.43824628, 0.42723188, 0.4140246, 0.45545098, 0.41486007, 0.43361476], [0.5611759, -10000, 0.5593076, 0.5643773, 0.5855415, 0.59578335, 0.5561558000000001, 0.6027558000000001, 0.5814695, -10000, 0.57656765, -10000, 0.57628924, 0.5998699000000001, 0.5749791999999999, 0.5984255999999999, 0.6108967, 0.5721701, 0.5699501], [0.47661668, -10000, 0.4844915, -10000, 0.48130837, 0.45660263, 0.46709323, 0.45984858, 0.39832684, -10000, 0.4699089, -10000, 0.47873148, 0.48964772, 0.46623188, 0.42301350000000004, 0.45492238, 0.4499031, 0.43037465]]
INFO:stan_model:observed_qed [[0.7489796999999999, 0.7378650999999999, 0.74791884, 0.7442868, 0.7342023, 0.75385916, 0.72146386, 0.7633512, 0.75816303, 0.7409456999999999, 0.7549256999999999, 0.76138306, 0.77322656, 0.7426869, 0.7616528, 0.7373048000000001, 0.74942136, 0.77128094, 0.7492310000000001], [0.7743646, 0.794371, 0.78198117, 0.7725719, 0.76363504, 0.7677518, 0.76887226, 0.7640985, 0.78418744, 0.7710963000000001, 0.7797035, -10000, 0.77546096, 0.7670238, 0.7853799, 0.77687836, 0.76827455, 0.79009736, 0.7741828000000001], [0.7666148, 0.7405313, 0.73471797, 0.74527353, 0.7543318, 0.7618725000000001, 0.7624781, 0.73796594, 0.73853624, -10000, 0.7489967, -10000, 0.76162416, 0.75515264, 0.77091384, 0.7575286, 0.7620478, 0.7709314, 0.7582088], [0.7448201, -10000, 0.7576348, 0.7650229000000001, 0.75602114, 0.744555, 0.76474655, 0.74403405, 0.7622952, -10000, 0.75759816, -10000, 0.7356946, 0.74859583, 0.7592542, 0.7572336, 0.73685366, 0.76114786, 0.74769914], [0.7677343000000001, -10000, 0.7780726, -10000, 0.7661581999999999, 0.78411245, 0.75588655, 0.7659701, 0.7849082, -10000, 0.7644441, -10000, 0.777058, 0.757775, 0.7902673000000001, 0.77442336, 0.7755368, 0.7779958, 0.7852882]]
INFO:stan_model:observed_sa [[0.9709618, 0.96645874, 0.9686812, 0.96624017, 0.9690295, 0.96778226, 0.9739032, 0.96643215, 0.9654983, 0.9714471, 0.96885467, 0.9541245999999999, 0.96594775, 0.9661943999999999, 0.96942496, 0.96489376, 0.96495795, 0.9703349, 0.9683413000000001], [0.9643251, 0.9658033000000001, 0.9698694999999999, 0.9653358, 0.9690908000000001, 0.9674613000000001, 0.9640476, 0.9669317, 0.9611274, 0.9686509, 0.9639781, -10000, 0.9652433000000001, 0.96836275, 0.9701947, 0.9638494000000001, 0.96148586, 0.9658377, 0.96774936], [0.9700238999999999, 0.9753828000000001, 0.9721688, 0.9683019, 0.970767, 0.9717351000000001, 0.96594787, 0.9687534999999999, 0.97058743, -10000, 0.97053915, -10000, 0.96729374, 0.9681525, 0.96644133, 0.9687283999999999, 0.9702052, 0.9697846, 0.968197], [0.9654533000000002, -10000, 0.9674957000000001, 0.96726227, 0.9702656999999999, 0.96958673, 0.9711153, 0.97023857, 0.9740279000000001, -10000, 0.970707, -10000, 0.9750165000000001, 0.97309124, 0.9681195, 0.97137237, 0.97529006, 0.9721298, 0.97281945], [0.97391653, -10000, 0.9758406, -10000, 0.9751023000000001, 0.9742738999999999, 0.974039, 0.97194135, 0.9776541, -10000, 0.9769163000000001, -10000, 0.9747406, 0.97621536, 0.97560024, 0.97350144, 0.9743828999999999, 0.9744759, 0.97362626]]