View source: R/mml_nb_adaptive.R
This function calculates the mml score of a NB model using the adaptive code approach. It is much simpler than using MML87 that involves complex fisher calculation. The output is the mml score of a NB without adding the extra bit for each parameter as what the multi-state mml adaptive code does, because we don't know the complete message length from MML87 for NB. But maybe this is ok, because we are not interested in the mml estimation of parameters.
1 2 | mml_nb_adaptive(data, arities, sampleSize, targetIndex, logProbTarget,
cachedPXGivenT, chIndices)
|
data |
A dataset whost variables are in numeric/integer format. Any categorical variables must be converted into numeric/integer first. |
arities |
A vector of variable arities. |
sampleSize |
The sample size. That is, the number of rows of data. |
targetIndex |
The target variable (or parent node) index. |
logProbTarget |
Log of the probability of the target variable. |
cachedPXGivenT |
Pre-calculated conditional probability of each node given its parents. In the case of Naive Bayes models, the only parent is the target variable. |
chIndices |
A vector of indices for the Xs (or child nodes). |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.