Classification Bayes Network Learner
Source:R/learner_RWeka_classif_bayes_net.R
mlr_learners_classif.bayes_net.RdBayes 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
Nremoved:Initial structure is empty
Premoved:Maximum number of parents
Rremoved:Random order
mbcremoved:Applies a Markov Blanket correction to the network structure, after a network structure is learned
Sremoved:Score type
Aremoved: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
Methods
Inherited methods
mlr3::Learner$base_learner()mlr3::Learner$configure()mlr3::Learner$encapsulate()mlr3::Learner$format()mlr3::Learner$help()mlr3::Learner$predict()mlr3::Learner$predict_newdata()mlr3::Learner$print()mlr3::Learner$reset()mlr3::Learner$selected_features()mlr3::Learner$train()mlr3::LearnerClassif$predict_newdata_fast()
Method marshal()
Marshal the learner's model.
Arguments
...(any)
Additional arguments passed tomlr3::marshal_model().
Method unmarshal()
Unmarshal the learner's model.
Arguments
...(any)
Additional arguments passed tomlr3::unmarshal_model().
Examples
# Define the Learner
learner = lrn("classif.bayes_net")
print(learner)
#>
#> ── <LearnerClassifBayesNet> (classif.bayes_net): Bayes Network ─────────────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3 and RWeka
#> • Predict Types: [response] and prob
#> • Feature Types: logical, integer, numeric, factor, and ordered
#> • Encapsulation: none (fallback: -)
#> • Properties: marshal, missings, multiclass, and twoclass
#> • Other settings: use_weights = 'error'
# Define a Task
task = tsk("sonar")
# Create train and test set
ids = 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(2): 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(2): Class
#> V37(1): Class
#> V38(1): Class
#> V39(1): Class
#> V4(2): Class
#> V40(1): 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(2): 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: -1314.3304662697399
#> LogScore BDeu: -1341.816873329646
#> LogScore MDL: -1349.1307597366024
#> LogScore ENTROPY: -1267.7119398399461
#> LogScore AIC: -1300.7119398399461
#>
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2173913