bayesRegressSimple: Perform simple (network) Bayesian regression.

Description Usage Arguments Author(s) References See Also Examples

View source: R/bayesSimple.R

Description

Uses simple Bayesian inferencing to segment the data given the conditional features. Then estimates a density over the remaining values of the target feature and returns the most likely value using a maximum a posteriori estimate of the kernel (returning its mode).

Usage

1
2
3
4
5
6
7
8
bayesRegressSimple(
  df,
  features,
  targetCol,
  selectedFeatureNames = c(),
  retainMinValues = 2,
  regressor = NULL
)

Arguments

df

data.frame

features

data.frame with bayes-features. One of the features needs to be the label-column (not required or no value required).

targetCol

string with the name of the feature that represents the label (here the target variable for regression).

selectedFeatureNames

vector default c(). Vector of strings that are the names of the features the to-predict label depends on. If an empty vector is given, then all of the features are used (except for the label). The order then depends on the features' order.

retainMinValues

integer to require a minimum amount of data points when segmenting the data feature by feature.

regressor

Function that is given the collected values for regression and thus finally used to select a most likely value. Defaults to the built-in estimator for the empirical PDF and returns its argmax. However, any other function can be used, too, such as min, max, median, average etc. You may also use this function to obtain the raw values for further processing.

Author(s)

Sebastian Hönel sebastian.honel@lnu.se

References

\insertRef

rpkg:bnlearn_4.5mmb

See Also

mmb::bayesInferSimple()

Examples

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))

# Note how we do not require "Petal.Length" among the features when regressing:
mmb::bayesRegressSimple(df = iris, features = rbind(feat1, feat2),
  targetCol = "Petal.Length")

mmb documentation built on Oct. 23, 2020, 5:21 p.m.

Related to bayesRegressSimple in mmb...