Description Usage Arguments Details Value References
View source: R/NSFA_gibbs_run_chain.R
This function runs a Gibbs sampler to obtain posterior samples from the NSFA model by Knowles & Ghahramani (2011). This is my personal implementation, which contains some corrections with respect to the model presented in the original article.
1 | NSFA_gibbs(S, Y, hp = NULL, Y_test = NULL, R = 1L, verbose = 0L)
|
S |
number of iterations for the chain. |
Y |
matrix with the observed data, of size |
hp |
list of hyperparameters. See Details for a description and default values used. |
Y_test |
matrix with test set for assessing out-of-sample performance.
Number of columns must be same as |
R |
function returns last |
verbose |
integer. Function prints every |
The model was originally proposed in Knowles & Ghahramani (2011). However, you can read my own report evaluating this model here.
The following hyperparameters can be supplied by the user through hp
.
Default values are in parenthesis and tend to work well.
e
: shape parameter of prior for alpha (1).
f
: rate parameter of prior for alpha (1).
a
: shape parameter of prior for psi^-1 (1).
a_0
: shape parameter of prior for b (1).
b_0
: rate parameter of prior for b (1).
c
: shape parameter of prior for lambda (1).
c_0
: shape parameter of prior for d (1).
d_0
: rate parameter of prior for d (1).
lambda_MH
: lambda parameter for kappa_d proposal (10).
pi_MH
: pi parameter for kappa_d proposal (0.1).
If chain keeps restarting, try increasing lambda_MH
and/or pi_MH
to get more aggressive proposals for growing Z.
List with two lists:
list with last R
samples of the chain.
list of traces of train set log-likelihood (ll), test set ll, and K.
Knowles, D., & Ghahramani, Z. (2011). Nonparametric Bayesian sparse factor models with application to gene expression modeling. The Annals of Applied Statistics, 1534-1552.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.