getStructure: Hybrid Bayesian Network structure learning

View source: R/structuralLearning.R

getStructureR Documentation

Hybrid Bayesian Network structure learning

Description

Learn the structure of a hybrid Bayesian network, using a fixed method (Naive Bayes, NB), a restricted method (Tree augmented Naive Bayes, TAN), or an unrestricted method (the hill climbing, HC, score-based local search method).

Usage

getStructure(data, method, target = NULL)

Arguments

data

A dataset with discrete and continuous variables. If the discrete variables are not of class "factor", they are automatically converted.

method

A "character" string indicating the method to learn the structure: NB (naive Bayes), TAN (Tree augmented Naive Bayes), or HC (hill climbing) are the available options.

target

An optional parameter only used in the case of NB and TAN to specify the class variable.

Details

getStructure() automatically converts non-numeric variables into factors before calling function hc() from the bnlearn package. In the case of TAN, it converts all numeric and non-numeric variables into factors (using 4 equal width intervals) before calling tree.bayes() from the bnlearn package.

Value

The output is a "bn" object containing the learned graph.

See Also

hc

Examples


## Data
data(ecoli)
ecoli <- ecoli[,-1] ## Sequence Name

## DAG1
dag1 <- getStructure(ecoli, method = "HC")
dag1
plot(dag1)

## DAG2
dag2 <- getStructure(ecoli, method = "TAN", target = "mcg")
dag2
plot(dag2)



MoTBFs documentation built on Oct. 6, 2026, 1:06 a.m.