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.
bayesComputeProductFactor(
df,
conditionalFeatures,
targetFeature,
computeNumerator,
retainMinValues = 1,
doEcdf = FALSE
)
data.frame with data that is used to segment
data.frame with Bayesian features, as produced
by @seealso mmb::createFeatureForBayes()
. This data.frame must not
be empty, as we need to depend on at least one feature.
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.
boolean to indicate whether a factor for the numerator is build. In that case, the target feature is required.
integer the amount of rows to minimally retain during segmenting using the conditional features.
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.
numeric the factor as probability or relative likelihood. If the target feature is discrete, a probability is returned; a relative likelihood, otherwise.
bayes1763liimmb