Computes the log of the additive inverse of a log value.
Computes the log of the additive inverse of a log value. E.g., given log p, we compute log(1 - p).
The log of the value.
The log of 1 minus the value.
From the perspective of numerical precision, we expect logP to be less than 0. This implies that P is expected to be between 0 and 1, non-inclusive.
Normalizes an array of log likelihoods.
Normalizes an array of log likelihoods.
The array to normalize.
Returns a normalized array.
Given two log scaled values, compute the log of the sum of the values.
Given two log scaled values, compute the log of the sum of the values. E.g., log(p + q) = logSum(log(p), log(q))
The log of the first value.
The log of the second value.
The log of the sums of the first value and the second value.
This function is not sensitive to the relative value of P and Q. We check inside of the function to determine whether P or Q is larger.
Given an array of log probabilities, computes the log of the sum of the probabilities.
Given an array of log probabilities, computes the log of the sum of the probabilities. E.g., computes:
log(p0 + ... + pn) = sumLogProbabilities(Array(log(p0), ..., log(pn))) ~ log(Array.map(exp(_)).sum)
Array of log probabilities to sum.
The log of the sum of the probabilities.
This function is not numerically sensitive to the order of the values in the array. The array is copied and sorted before the sum is applied.
logSum