mml_nb_adaptive: MML Naive Bayes using adaptive code approach (faster version)

Description Usage Arguments

View source: R/mml_nb_adaptive.R

Description

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.

Usage

1
2
mml_nb_adaptive(data, arities, sampleSize, targetIndex, logProbTarget,
  cachedPXGivenT, chIndices)

Arguments

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


kelvinyangli/mbmml documentation built on June 29, 2020, 3:12 a.m.