sampleFeatureAllocation: Sample from a Feature Allocation Distribution

Description Usage Arguments Value Examples

View source: R/sampleFeatureAllocation.R

Description

This function obtains a sample from a previously defined feature allocation distribution object using wither the ibp or the aibd functions.

Usage

1
2
3
4
5
6
sampleFeatureAllocation(
  nSamples,
  distribution,
  implementation = "scala",
  parallel = TRUE
)

Arguments

nSamples

An integer giving the number of samples

distribution

A feature allocation distribution object as defined in the functions aibd or ibp.

implementation

The default of "scala" should be used. The "R" option is not a supported implementation.

parallel

Whether multiple cores should be used to generate the samples.

Value

A list of feature allocation matrices sampled from the supplied distribution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 # Regardless of size, the initial warmup can exceed CRAN's 5 seconds threshold
d1 <- ibp(1,4)

states <- c("California","Wisconsin","Nebraska","New York")
data <- USArrests[states,]
dist <- dist(scale(data))
d2 <- aibd(1, seq_along(states), 1.0, dist)

samples_ibp <- sampleFeatureAllocation(10, d1, parallel=FALSE)
samples_aibd <- sampleFeatureAllocation(15, d2, parallel=FALSE)

aibd documentation built on June 5, 2021, 1:06 a.m.