learn_params | R Documentation |
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
.
lp( x, dataset, smooth, awnb_trees = NULL, awnb_bootstrap = NULL, manb_prior = NULL, wanbia = NULL )
x |
The |
dataset |
The data frame from which to learn network parameters. |
smooth |
A numeric. The smoothing value (α) for Bayesian parameter estimation. Nonnegative. |
awnb_trees |
An integer. The number (M) of bootstrap samples to generate. |
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 |
lp
learns the parameters of each local distribution θ[ijk] = P(X[i] = k | Pa(X[i]) =
j) as
θ[ijk] = (N[ijk] + α) / (N[ ij . ] + r[i] α),
where
N[ijk] is the number of instances in dataset
in which
X[i] = k and Pa(X[i]) = j,
N[ ij . ] = ∑[k=1]^(r[i])
N[ijk], r[i] is the cardinality of X[i], and all
hyperparameters of the Dirichlet prior equal to α. α =
0 corresponds to maximum likelihood estimation. Returns a uniform
distribution when N[ ij . ] + r[i]
α = 0. 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 w_i \in [0, 1]. 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:
θ[ijk]^(AWNB) = (θ[ijk])^w[i] / ∑[k=1]^(r[i]) (θ[ijk])^(w[i]),
while the weights w[i] are computed as
w_i = (1 / M)∑_[t=1]^M √{1 / d[ti]},
where M is the number of
bootstrap samples from dataset
and d[ti] the minimum
testing depth of X[i] in an unpruned classification tree learned
from the t-th subsample (d[ti] = 0 if X_i
is omitted from t-th tree).
The MANB parameters correspond to Bayesian model averaging over the naive
Bayes models obtained from all 2^n subsets over the n
features. To get MANB parameters, provide the manb_prior
argument.
A bnc_bn
object.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.