Description Usage Arguments Value See Also Examples
Initialise a hdpState object with one or more DP nodes and their parent relationships,
the parameters of the base Dirichlet distribution, and a set of hyperparameters
for the gamma priors over the DP concentration parameters. Further DP nodes can
be added with hdp_adddp
, and further concentration parameters can
be added with hdp_addconparam
. Data is assigned via hdp_setdata
.
When initialised, the DP nodes are 'heldout' (not available for posterior sampling)
and will need to be activated (see dp_activate
). Finally, the posterior
sampling process (a Gibbs sampler) is run via hdp_posterior
.
1 |
ppindex |
Index (or indices) of the parental process(es) for the initial DPs. The 'top' DP should have parent process '0' (the base Dirichlet distribution). |
cpindex |
Index (or indices) of the concentration parameter(s) for the initial DPs. |
hh |
Parameters of the base Dirichlet distribution (like psuedocounts across categories). Must be a vector with length equal to the number of data item categories. |
alphaa |
Shape hyperparameters for the gamma priors over the DP concentration parameters. |
alphab |
Rate hyperparameters for the gamma priors over the DP concentration parameters. |
A hdpState object with the initial HDP structure. See hdpState-class
hdp_quick_init
, hdp_prior_init
,
hdp_addconparam
, hdp_adddp
,
hdp_setdata
, dp_activate
, hdp_posterior
1 2 3 4 5 6 7 8 9 10 | # initialise a HDP with just one 'top' DP node off the base distribution,
# a uniform Dirichlet base distribution over six possible data categories,
# and three possible concentration parameters to be shared across the HDP tree
# (top DP using conparam number 1), each with hyperparameters (1,2).
hdp_init(ppindex=0, cpindex=1, hh=rep(1, 6), alphaa=rep(1, 3), alphab=rep(2, 3))
# initialise a HDP with one 'top' DP node off the base distribution,
# AND two children DP nodes off that parent. The two children DPs share a different
# concentration parameter (hyperparameters are (2, 0.5)).
hdp_init(ppindex=c(0, 1, 1), cpindex=c(1, 2, 2), hh=rep(1, 6), alphaa=rep(2, 2), alphab=rep(0.5, 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.