Learn R Programming

MoTBFs (version 2.0)

MOPTAN: Fitting MoTBFs TAN models

Description

Perform a TAN model of class MoTBF based on maximizing the Mutual Information.

Usage

fit_tan(
  target,
  data,
  fit.args = NULL,
  root = NULL,
  all = FALSE,
  mutualInfoCond = NULL,
  parallel = FALSE
)

mutual_information_tan(data, target, fit.args = NULL, parallel = FALSE)

Value

The main function, fit_tan(), returns an object of class "motbf_fit". When all=TRUE, it returns a list with the Bayesian network and the mutual information matrix used to compute the maximun spanning tree.

Function mutual_information_tan() returns a symmetric numeric matrix of dimensions \(k \times k\), where \(k\) is the number of predictor variables. Row and column names correspond to the predictor variables, and the entries contain the estimated conditional mutual information values. This matrix is used to compute the TAN model.

Arguments

target

A character string indicating the name of the target or class variable. Target must be a column of data and it can be a continuous or discrete variable.

data

A data.frame containing the variables, which can contain continuous and discrete variables.

fit.args

A list a list containing optional arguments used to fit the models. These arguments must be those accepted by function motbf.fit, i.e., 'numIntervals' (4), 'POTENTIAL_TYPE' ('MOP'), 'maxParam' (7), 's' (NULL), 'priorData' (NULL) or 'scale' (TRUE). If fit.args is left NULL, the default values (in brackets) for those arguments will be used.

root

A character string indicating the label of the root predictor variable of TAN model.

all

A logical flag. If TRUE, the function return a list which contains two elements: the TAN model and the mutual information used to compute the maximum spanning tree. Defaults to FALSE.

mutualInfoCond

A numeric matrix indicating the estimation of the mutual information coefficientes for Chow-Liu- algorithm in TAN. If it is NULL, it is computed using mutual_information_tan function.

parallel

A logical flag. If TRUE, computation runs in parallel using foreach and doParallel. Defaults to FALSE.

Details

The main function, fit_tan(), fits a MoTBF Tree Augmented Naive Bayes model using the specified data.

Examples

Run this code
# \donttest{
data = iris
data$Species = as.factor(data$Species)
# Fit TAN model for classification
tan = fit_tan("Species",data)
# }

Run the code above in your browser using DataLab