R/bayesSimple.R
    bayesProbabilitySimple.RdUses simple Bayesian inference to return the probability or relative likelihood or a discrete label or continuous value.
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.
Scutari M (2010). “Learning Bayesian Networks with the bnlearn R Package.” Journal of Statistical Software, 35(3), 1--22. doi: 10.18637/jss.v035.i03 .
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)#> [1] 0.475