bayesComputeProductFactor {mmb} | R Documentation |
Computes one single factor that is needed for full Bayesian inferencing.
Description
In an equation such as P(A|B) = P(B|A) * P(A) / P(B), the target feature is A, while the conditional feature is B. There are three factors in that equation (two in the numerator and one in the denominator). This function calculates exactly one factor and expects all features to be given in the right order. If computing the denominator, no target-feature is required.
Usage
bayesComputeProductFactor(
df,
conditionalFeatures,
targetFeature,
computeNumerator,
retainMinValues = 1,
doEcdf = FALSE
)
Arguments
df |
data.frame with data that is used to segment |
conditionalFeatures |
data.frame with Bayesian features, as produced
by @seealso |
targetFeature |
data.frame with exactly one Bayesian feature. Any excessive features are discarded and a warning is produced. If computing a factor for the denominator, this data.frame may be empty. |
computeNumerator |
boolean to indicate whether a factor for the numerator is build. In that case, the target feature is required. |
retainMinValues |
integer the amount of rows to minimally retain during segmenting using the conditional features. |
doEcdf |
default FALSE a boolean to indicate whether to use the empirical CDF to return a probability when inferencing a continuous feature. If false, uses the empirical PDF to return the rel. likelihood. This parameter does not have any effect when inferring discrete values. Using the ECDF, a probability to find a value less than or equal to the given value is returned. Setting this parameter to true in conjunction with a non-zero shiftAmount must be done with caution. |
Value
numeric the factor as probability or relative likelihood. If the target feature is discrete, a probability is returned; a relative likelihood, otherwise.
Author(s)
Sebastian Hönel sebastian.honel@lnu.se
References
Bayes T (1763). “LII. An essay towards solving a problem in the doctrine of chances. By the late Rev. Mr. Bayes, FRS communicated by Mr. Price, in a letter to John Canton, AMFR S.” Philosophical transactions of the Royal Society of London, 370–418.