hdp_adddp: Add DPs to a hdpState object

Description Usage Arguments Value See Also Examples

View source: R/hdp_adddp.R

Description

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.

Usage

1

Arguments

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.

Value

A hdpState object with the updated HDP structure. See hdpState-class

See Also

hdp_init, hdp_setdata, dp_activate, hdp_posterior

Examples

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

nicolaroberts/hdp documentation built on May 23, 2019, 5:09 p.m.