Description Usage Arguments Value Author(s) References See Also Examples
Uses simple Bayesian inference to return the probability or relative likelihood or a discrete label or continuous value.
1 2 3 4 5 6 7 8 | bayesProbabilitySimple(
df,
features,
targetCol,
selectedFeatureNames = c(),
retainMinValues = 1,
doEcdf = FALSE
)
|
df |
data.frame |
features |
data.frame with bayes-features. One of the features needs to be the label-column. |
targetCol |
string with the name of the feature that represents the label. |
selectedFeatureNames |
vector default |
retainMinValues |
integer to require a minimum amount of data points when segmenting the data feature by feature. |
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. |
double the probability of the target-label, using the maximum a posteriori estimate.
Sebastian Hönel sebastian.honel@lnu.se
rpkg:bnlearn_4.5mmb
1 2 3 4 5 6 7 8 | feat1 <- mmb::createFeatureForBayes(
name = "Sepal.Length", value = mean(iris$Sepal.Length))
feat2 <- mmb::createFeatureForBayes(
name = "Sepal.Width", value = mean(iris$Sepal.Width), isLabel = TRUE)
# Assign a probability to a continuous variable (also works with nominal):
mmb::bayesProbabilitySimple(df = iris, features = rbind(feat1, feat2),
targetCol = feat2$name, retainMinValues = 5, doEcdf = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.