Classification Bayes Network Learner
mlr_learners_classif.bayes_net.Rd
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.
Parameters
Id | Type | Default | Levels | Range |
subset | untyped | - | - | |
na.action | untyped | - | - | |
D | logical | - | TRUE, FALSE | - |
B | untyped | - | - | |
Q | character | - | global.K2, global.HillClimber, global.SimulatedAnnealing, global.TabuSearch, global.TAN, local.K2, local.HillClimber, local.LAGDHillClimber, local.SimulatedAnnealing, local.TabuSearch, ... | - |
E | character | - | estimate.SimpleEstimator, estimate.BMAEstimator, estimate.MultiNomialBMAEstimator | - |
output_debug_info | logical | FALSE | TRUE, FALSE | - |
do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
num_decimal_places | integer | 2 | \([1, \infty)\) | |
batch_size | integer | 100 | \([1, \infty)\) | |
options | untyped | NULL | - |
See also
as.data.table(mlr_learners)
for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner
-> mlr3::LearnerClassif
-> LearnerClassifBayesNet
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(1): Class
#> V10(2): Class
#> V11(2): Class
#> V12(2): Class
#> V13(2): Class
#> V14(1): Class
#> V15(1): Class
#> V16(1): Class
#> V17(1): Class
#> V18(1): Class
#> V19(1): Class
#> V2(1): 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(2): Class
#> V4(1): Class
#> V40(2): Class
#> V41(1): Class
#> V42(1): Class
#> V43(1): Class
#> V44(2): Class
#> V45(2): Class
#> V46(1): Class
#> V47(2): Class
#> V48(2): Class
#> V49(2): Class
#> V5(1): Class
#> V50(1): Class
#> V51(1): Class
#> V52(2): Class
#> V53(1): Class
#> V54(1): 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: -975.8912038846472
#> LogScore BDeu: -999.9418100620645
#> LogScore MDL: -1013.4916494067043
#> LogScore ENTROPY: -941.9417773763095
#> LogScore AIC: -970.9417773763095
#>
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2028986