Skip to contents

Bayes Network learning using various search algorithms. Calls RWeka::make_Weka_classifier() from RWeka.

Custom mlr3 parameters

  • output_debug_info:

    • original id: output-debug-info

  • do_not_check_capabilities:

    • original id: do-not-check-capabilities

  • num_decimal_places:

    • original id: num-decimal-places

  • batch_size:

    • original id: batch-size

  • Reason for change: This learner contains changed ids of the following control arguments since their ids contain irregular pattern

  • N removed:

    • Initial structure is empty

  • P removed:

    • Maximum number of parents

  • R removed:

    • Random order

  • mbc removed:

    • Applies a Markov Blanket correction to the network structure, after a network structure is learned

  • S removed:

    • Score type

  • A removed:

    • Initial count (alpha)

  • Reason for change: The parameters are removed because they don't work out of the box and it's unclear how to use them.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.bayes_net")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”

  • Required Packages: mlr3, RWeka

Parameters

IdTypeDefaultLevelsRange
subsetuntyped--
na.actionuntyped--
Dlogical-TRUE, FALSE-
Buntyped--
Qcharacter-global.K2, global.HillClimber, global.SimulatedAnnealing, global.TabuSearch, global.TAN, local.K2, local.HillClimber, local.LAGDHillClimber, local.SimulatedAnnealing, local.TabuSearch, ...-
Echaracter-estimate.SimpleEstimator, estimate.BMAEstimator, estimate.MultiNomialBMAEstimator-
output_debug_infologicalFALSETRUE, FALSE-
do_not_check_capabilitieslogicalFALSETRUE, FALSE-
num_decimal_placesinteger2\([1, \infty)\)
batch_sizeinteger100\([1, \infty)\)
optionsuntypedNULL-

See also

Author

damirpolat

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifBayesNet

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifBayesNet$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = mlr3::lrn("classif.bayes_net")
print(learner)
#> <LearnerClassifBayesNet:classif.bayes_net>: Bayes Network
#> * Model: -
#> * Parameters: list()
#> * Packages: mlr3, RWeka
#> * Predict Types:  [response], prob
#> * Feature Types: logical, integer, numeric, factor, ordered
#> * Properties: missings, multiclass, twoclass

# Define a Task
task = mlr3::tsk("sonar")

# Create train and test set
ids = mlr3::partition(task)

# Train the learner on the training ids
learner$train(task, row_ids = ids$train)

print(learner$model)
#> Bayes Network Classifier
#> not using ADTree
#> #attributes=61 #classindex=0
#> Network structure (nodes followed by parents)
#> Class(2): 
#> V1(2): Class 
#> V10(2): Class 
#> V11(2): Class 
#> V12(2): Class 
#> V13(2): Class 
#> V14(2): Class 
#> V15(1): Class 
#> V16(1): Class 
#> V17(1): Class 
#> V18(1): Class 
#> V19(1): Class 
#> V2(2): Class 
#> V20(1): Class 
#> V21(1): Class 
#> V22(1): Class 
#> V23(1): Class 
#> V24(1): Class 
#> V25(1): Class 
#> V26(1): Class 
#> V27(1): Class 
#> V28(2): Class 
#> V29(1): Class 
#> V3(1): Class 
#> V30(1): Class 
#> V31(1): Class 
#> V32(1): Class 
#> V33(1): Class 
#> V34(1): Class 
#> V35(1): Class 
#> V36(1): Class 
#> V37(1): Class 
#> V38(1): Class 
#> V39(1): Class 
#> V4(1): Class 
#> V40(1): Class 
#> V41(1): Class 
#> V42(1): Class 
#> V43(1): Class 
#> V44(2): Class 
#> V45(2): Class 
#> V46(2): Class 
#> V47(2): Class 
#> V48(2): Class 
#> V49(2): Class 
#> V5(1): Class 
#> V50(1): Class 
#> V51(2): Class 
#> V52(2): Class 
#> V53(1): Class 
#> V54(2): Class 
#> V55(1): Class 
#> V56(1): Class 
#> V57(1): Class 
#> V58(1): Class 
#> V59(1): Class 
#> V6(1): Class 
#> V60(1): Class 
#> V7(1): Class 
#> V8(1): Class 
#> V9(2): Class 
#> LogScore Bayes: -1355.9275146390603
#> LogScore BDeu: -1386.8497225814547
#> LogScore MDL: -1400.0913625565756
#> LogScore ENTROPY: -1308.803594793658
#> LogScore AIC: -1345.803594793658
#> 


# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)

# Score the predictions
predictions$score()
#> classif.ce 
#>  0.2753623