Comparing the paper(https://dl.acm.org/doi/10.1145/2872427.2883046) and the code, I have the following questions:
why alpha_bar is the subtraction alpha.row(t+1) - alpha.row(t-1)? should it be (alpha.row(t+1) + alpha.row(t-1))/2?
why sigma is calculated as 1.0 / (1.0 / alpha_precision + (D[t] / dtm_eta_var))? should it be 1.0 / ( alpha_precision + (D[t] / dtm_eta_var)) since alpha_precision is (2 / dtm_alpha_var)?
// sample alpha
VectorXf alpha_bar(K);
float alpha_precision = 0.0; // designed to be a diagonal matrix
MatrixXf cov = MatrixXf::Identity(K, K);
if (t == 0) {
alpha_precision = (1.0 / 100) + (1 / dtm_alpha_var);
float alpha_sigma = 1.0 / alpha_precision;
alpha_bar = alpha.row(t+1) * (alpha_sigma / dtm_alpha_var);
} else if (t == T-1) {
alpha_bar = (alpha.row(t-1) - alpha.row(t)) / dtm_alpha_var;
alpha_precision = 1.0 / dtm_alpha_var;
} else {
alpha_precision = (2 / dtm_alpha_var);
alpha_bar = (alpha.row(t+1) - alpha.row(t-1)) / 2;
}
VectorXf eta_bar = eta[t].colwise().sum();
float sigma = 1.0 / (1.0 / alpha_precision + (D[t] / dtm_eta_var));
cov *= sigma;
mean = (alpha_bar / alpha_precision + (eta_bar / dtm_eta_var)) * sigma;
alpha.row(t) = get_mvn_samples(mean, cov);
Comparing the paper(https://dl.acm.org/doi/10.1145/2872427.2883046) and the code, I have the following questions:
why alpha_bar is the subtraction alpha.row(t+1) - alpha.row(t-1)? should it be (alpha.row(t+1) + alpha.row(t-1))/2?
why sigma is calculated as 1.0 / (1.0 / alpha_precision + (D[t] / dtm_eta_var))? should it be 1.0 / ( alpha_precision + (D[t] / dtm_eta_var)) since alpha_precision is (2 / dtm_alpha_var)?
// sample alpha
VectorXf alpha_bar(K);
float alpha_precision = 0.0; // designed to be a diagonal matrix
MatrixXf cov = MatrixXf::Identity(K, K);
if (t == 0) {
alpha_precision = (1.0 / 100) + (1 / dtm_alpha_var);
float alpha_sigma = 1.0 / alpha_precision;
alpha_bar = alpha.row(t+1) * (alpha_sigma / dtm_alpha_var);
} else if (t == T-1) {
alpha_bar = (alpha.row(t-1) - alpha.row(t)) / dtm_alpha_var;
alpha_precision = 1.0 / dtm_alpha_var;
} else {
alpha_precision = (2 / dtm_alpha_var);
alpha_bar = (alpha.row(t+1) - alpha.row(t-1)) / 2;
}
VectorXf eta_bar = eta[t].colwise().sum();
float sigma = 1.0 / (1.0 / alpha_precision + (D[t] / dtm_eta_var));
cov *= sigma;
mean = (alpha_bar / alpha_precision + (eta_bar / dtm_eta_var)) * sigma;
alpha.row(t) = get_mvn_samples(mean, cov);