Description Usage Arguments Value See Also Examples
View source: R/hdp_posterior.R
Run a Gibbs sampler over the activated DP nodes of a Hierarchichal Dirichlet Process.
Each iteration re-assigns the cluster allocation of every data item.
Run burnin
iterations, and then collect n
samples from the chain
with space
iterations between each collected sample. To plot output,
see plot_lik
, plot_numcluster
, and
plot_data_assigned
. Can collect multiple
independent HDP sampling chains in a hdpSampleMulti object via hdp_multi_chain
.
Components are extracted via hdp_extract_components
.
1 2 | hdp_posterior(hdp, burnin, n, space, cpiter = 1, seed = sample(1:10^7, 1),
verbosity = 0)
|
hdp |
A hdpState object |
burnin |
The number of burn-in iterations. |
n |
The number of posterior samples to collect. |
space |
The number of iterations between collected samples. |
cpiter |
The number of iterations of concentration parameter sampling to perform after each iteration. |
seed |
The (integer) seed that can be set to reproduce output. Default is a random seed from 1 – 10^7, reported in the output. |
verbosity |
Verbosity of debugging statements. 0 (least verbose) – 4 (most verbose). 0 highly recommended - only change for debugging small examples. |
A hdpSampleChain object with the salient information from each
posterior sample. See hdpSampleChain-class
hdp_multi_chain
, hdp_extract_components
,
cull_posterior_samples
, plot_lik
, plot_numcluster
,
plot_data_assigned
1 2 3 4 5 6 | my_hdp <- hdp_init(ppindex=0, cpindex=1, hh=rep(1, 6), alphaa=rep(1, 3), alphab=rep(2, 3))
my_hdp <- hdp_adddp(my_hdp, 2, 1, 2)
my_hdp <- hdp_adddp(my_hdp, 10, c(rep(2, 5), rep(3, 5)), 3)
my_hdp <- hdp_setdata(my_hdp, 4:13, example_data_hdp)
my_hdp <- dp_activate(my_hdp, 1:13, 2)
my_hdp_chain <- hdp_posterior(my_hdp, 100, 100, 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.