Learn R Programming

BayesianDisaggregation (version 0.1.2)

numerical_stability_exp: Numerical stability (exponential penalty)

Description

Penalizes numerical issues in \(W\): (i) deviation of each row sum from 1, measured by the mean absolute deviation, and (ii) count of negative entries. The score is \(\exp(-(a\,\mathrm{msd} + b\,\#\mathrm{neg}))\).

Usage

numerical_stability_exp(W, a = 1000, b = 10)

Value

Scalar numerical stability score in \([0,1]\).

Arguments

W

Posterior matrix (\(T \times K\)).

a

Sensitivity for row-sum deviation (default 1000).

b

Sensitivity for negative counts (default 10).

Examples

Run this code
W <- matrix(runif(20), 5); W <- W/rowSums(W)
numerical_stability_exp(W)

Run the code above in your browser using DataLab