dp_activate: Activate DP nodes

Description Usage Arguments Details Value See Also Examples

View source: R/dp_activate.R

Description

Specifiy the number of starting clusters, and activate the DP nodes to be included in the posterior sampling process (hdp_posterior). When initialised, the DP nodes are 'heldout' (not available for posterior sampling).

Usage

1
dp_activate(hdp, dpindex, initcc, seed = sample(1:10^7, 1))

Arguments

hdp

A hdpState object

dpindex

Indices of the DPs to activate (include all parent DPs)

initcc

Number of data clusters to start with (every data item is randomly assigned to a cluster to start with)

seed

The (integer) seed that can be set to reproduce output. Default is a random seed from 1 – 10^7, reported in the output.

Details

Note that this step can be slow and memory-intensive for very large datasets.

Value

A hdpState object with activated DPs and an initial random cluster allocation for each data item. See hdpState-class

See Also

hdp_init, hdp_addconparam, hdp_adddp, hdp_setdata, hdp_posterior

Examples

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)
# active all DPs and start with two data clusters
my_hdp <- dp_activate(my_hdp, 1:13, 2)

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