compute_expected_loss {fangs}R Documentation

Estimate the expected FARO Loss for a Feature Allocation

Description

A Monte Carlo estimate of the expected FARO loss is computed for a feature allocation given a set of posterior samples.

Usage

compute_expected_loss(samples, Z, a = 1, nCores = 0)

Arguments

samples

An object of class ‘list’ containing posterior samples from a feature allocation distribution. Each list element encodes one feature allocation as a binary matrix, with items in the rows and features in the columns.

Z

A feature allocation in binary matrix form, with items in the rows and features in the columns.

a

A numeric scalar for the cost parameter of generalized Hamming distance used in FARO loss. The other cost parameter, b, is equal to 2 - a.

nCores

The number of CPU cores to use, i.e., the number of simultaneous calculations at any given time. A value of zero indicates to use all cores on the system.

Value

The estimated expected FARO loss as a scalar value.

References

D. B. Dahl, D. J. Johnson, R. J. Andros (2023+), Comparison and Bayesian Estimation of Feature Allocations, Journal of Computational and Graphical Statistics, doi:10.1080/10618600.2023.2204136.

Examples

data(samplesFA)
Z <- matrix(sample(c(0,1), 60, replace=TRUE), byrow=TRUE, nrow=20)
compute_expected_loss(samplesFA, Z)


[Package fangs version 0.2.13 Index]