learn_params {bnclassify} | R Documentation |
Learn the parameters of a Bayesian network structure.
Description
Learn parameters with maximum likelihood or Bayesian estimation, the
weighting attributes to alleviate naive bayes' independence assumption (WANBIA),
attribute weighted naive Bayes (AWNB), or the model averaged naive Bayes
(MANB) methods. Returns a bnc_bn
.
Usage
lp(
x,
dataset,
smooth,
awnb_trees = NULL,
awnb_bootstrap = NULL,
manb_prior = NULL,
wanbia = NULL
)
Arguments
x |
The |
dataset |
The data frame from which to learn network parameters. |
smooth |
A numeric. The smoothing value ( |
awnb_trees |
An integer. The number ( |
awnb_bootstrap |
A numeric. The size of the bootstrap subsample,
relative to the size of |
manb_prior |
A numeric. The prior probability for an arc between the class and any feature. |
wanbia |
A logical. If |
Details
lp
learns the parameters of each local distribution as
where
is the number of instances in
dataset
in which
and
,
,
is the cardinality of
, and all
hyperparameters of the Dirichlet prior equal to
.
corresponds to maximum likelihood estimation. Returns a uniform
distribution when
. With partially observed data, the above amounts to
available case analysis.
WANBIA learns a unique exponent 'weight' per feature. They are
computed by optimizing conditional log-likelihood, and are bounded with
all . For WANBIA estimates, set
wanbia
to TRUE
.
In order to get the AWNB parameter estimate, provide either the
awnb_bootstrap
and/or the awnb_trees
argument. The estimate is:
while the weights are
computed as
where is the number of
bootstrap samples from
dataset
and the minimum
testing depth of
in an unpruned classification tree learned
from the
-th subsample (
if
is omitted from
-th tree).
The MANB parameters correspond to Bayesian model averaging over the naive
Bayes models obtained from all subsets over the
features. To get MANB parameters, provide the
manb_prior
argument.
Value
A bnc_bn
object.
References
Hall M (2004). A decision tree-based attribute weighting filter for naive Bayes. Knowledge-based Systems, 20(2), 120-126.
Dash D and Cooper GF (2002). Exact model averaging with naive Bayesian classifiers. 19th International Conference on Machine Learning (ICML-2002), 91-98.
Pigott T D (2001) A review of methods for missing data. Educational research and evaluation, 7(4), 353-383.
Examples
data(car)
nb <- nb('class', car)
# Maximum likelihood estimation
mle <- lp(nb, car, smooth = 0)
# Bayesian estimaion
bayes <- lp(nb, car, smooth = 0.5)
# MANB
manb <- lp(nb, car, smooth = 0.5, manb_prior = 0.5)
# AWNB
awnb <- lp(nb, car, smooth = 0.5, awnb_trees = 10)