Description Usage Arguments Value See Also Examples
Add DP nodes to a hdpState object and specify each parent relationship
and concentration parameter. Concentration parameters can be added to a
hdpState object 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 |
hdp |
A hdpState object |
numdp |
The number of DPs to add |
ppindex |
Index (or indices) of the parental process(es) for the new DPs. |
cpindex |
Index (or indices) of the concentration parameters for the new DPs. |
A hdpState object with the updated HDP structure. See hdpState-class
hdp_init
, hdp_setdata
,
dp_activate
, hdp_posterior
1 2 3 4 5 6 7 8 9 | my_hdp <- hdp_init(ppindex=0, cpindex=1, hh=rep(1, 6), alphaa=rep(1, 3), alphab=rep(2, 3))
# add two more DPs with parent '1' and concentration parameter '2'
my_hdp <- hdp_adddp(my_hdp, 2, 1, 2)
my_hdp
hdp_example <- hdp_init(c(0, 1, 1), c(1, 2, 2), rep(1, 6), rep(2, 2), rep(0.5, 2))
# add six more DPs, three with parent '2', three with parent '3',
# and all with concentration parameter '2'
hdp_example <- hdp_adddp(hdp_example, 6, c(2, 2, 2, 3, 3, 3), 2)
hdp_example
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.