Skip to contents

Naive Bayes Classifier Using Estimator Classes. 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

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.naive_bayes_weka")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

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

  • Required Packages: mlr3, mlr3extralearners, RWeka

Parameters

IdTypeDefaultLevelsRange
subsetuntyped--
na.actionuntyped--
KlogicalFALSETRUE, FALSE-
DlogicalFALSETRUE, FALSE-
OlogicalFALSETRUE, FALSE-
output_debug_infologicalFALSETRUE, FALSE-
do_not_check_capabilitieslogicalFALSETRUE, FALSE-
num_decimal_placesinteger2\([1, \infty)\)
batch_sizeinteger100\([1, \infty)\)
optionsuntypedNULL-

References

John GH, Langley P (1995). “Estimating Continuous Distributions in Bayesian Classifiers.” In Eleventh Conference on Uncertainty in Artificial Intelligence, 338-345.

See also

Author

damirpolat

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifNaiveBayesWeka

Active bindings

marshaled

(logical(1))
Whether the learner has been marshaled.

Methods

Inherited methods


LearnerClassifNaiveBayesWeka$new()

Creates a new instance of this R6 class.


LearnerClassifNaiveBayesWeka$marshal()

Marshal the learner's model.

Usage

LearnerClassifNaiveBayesWeka$marshal(...)

Arguments

...

(any)
Additional arguments passed to mlr3::marshal_model().


LearnerClassifNaiveBayesWeka$unmarshal()

Unmarshal the learner's model.

Usage

LearnerClassifNaiveBayesWeka$unmarshal(...)

Arguments

...

(any)
Additional arguments passed to mlr3::unmarshal_model().


LearnerClassifNaiveBayesWeka$clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifNaiveBayesWeka$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("classif.naive_bayes_weka")
print(learner)
#> 
#> ── <LearnerClassifNaiveBayesWeka> (classif.naive_bayes_weka): Naive Bayes ──────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3extralearners, 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', predict_raw = 'FALSE'

# 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)
#> Naive Bayes Classifier
#> 
#>                  Class
#> Attribute            M       R
#>                 (0.55)  (0.45)
#> ===============================
#> V1
#>   mean           0.0316  0.0215
#>   std. dev.       0.022  0.0138
#>   weight sum         76      63
#>   precision      0.0009  0.0009
#> 
#> V10
#>   mean           0.2508   0.158
#>   std. dev.       0.128  0.1173
#>   weight sum         76      63
#>   precision       0.005   0.005
#> 
#> V11
#>   mean           0.2976  0.1664
#>   std. dev.      0.1246  0.1037
#>   weight sum         76      63
#>   precision      0.0051  0.0051
#> 
#> V12
#>   mean           0.3178  0.1807
#>   std. dev.      0.1237  0.1209
#>   weight sum         76      63
#>   precision       0.004   0.004
#> 
#> V13
#>   mean            0.325  0.2326
#>   std. dev.      0.1337  0.1285
#>   weight sum         76      63
#>   precision      0.0049  0.0049
#> 
#> V14
#>   mean           0.3223   0.267
#>   std. dev.      0.1725  0.1653
#>   weight sum         76      63
#>   precision       0.007   0.007
#> 
#> V15
#>   mean           0.3285  0.3079
#>   std. dev.      0.2002  0.2101
#>   weight sum         76      63
#>   precision      0.0073  0.0073
#> 
#> V16
#>   mean           0.3781  0.3747
#>   std. dev.      0.2142   0.248
#>   weight sum         76      63
#>   precision      0.0073  0.0073
#> 
#> V17
#>   mean           0.4102  0.4148
#>   std. dev.      0.2405  0.2807
#>   weight sum         76      63
#>   precision      0.0073  0.0073
#> 
#> V18
#>   mean           0.4495  0.4518
#>   std. dev.      0.2603  0.2555
#>   weight sum         76      63
#>   precision       0.007   0.007
#> 
#> V19
#>   mean           0.5301  0.4548
#>   std. dev.      0.2576   0.249
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V2
#>   mean           0.0417  0.0314
#>   std. dev.      0.0312  0.0264
#>   weight sum         76      63
#>   precision      0.0013  0.0013
#> 
#> V20
#>   mean           0.6038  0.4812
#>   std. dev.      0.2516  0.2531
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V21
#>   mean           0.6587  0.5278
#>   std. dev.      0.2474  0.2442
#>   weight sum         76      63
#>   precision      0.0071  0.0071
#> 
#> V22
#>   mean           0.6867  0.5602
#>   std. dev.      0.2371  0.2543
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V23
#>   mean           0.7001  0.6137
#>   std. dev.      0.2338  0.2457
#>   weight sum         76      63
#>   precision       0.007   0.007
#> 
#> V24
#>   mean           0.7182  0.6546
#>   std. dev.      0.2266  0.2347
#>   weight sum         76      63
#>   precision      0.0074  0.0074
#> 
#> V25
#>   mean           0.7168  0.6593
#>   std. dev.      0.2258  0.2579
#>   weight sum         76      63
#>   precision      0.0073  0.0073
#> 
#> V26
#>   mean            0.728  0.6866
#>   std. dev.      0.2311  0.2375
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V27
#>   mean           0.7332  0.6882
#>   std. dev.      0.2525  0.2252
#>   weight sum         76      63
#>   precision      0.0077  0.0077
#> 
#> V28
#>   mean           0.7179  0.6903
#>   std. dev.      0.2666  0.1953
#>   weight sum         76      63
#>   precision      0.0075  0.0075
#> 
#> V29
#>   mean           0.6445   0.638
#>   std. dev.        0.26  0.2306
#>   weight sum         76      63
#>   precision      0.0075  0.0075
#> 
#> V3
#>   mean           0.0468  0.0367
#>   std. dev.      0.0336  0.0287
#>   weight sum         76      63
#>   precision      0.0015  0.0015
#> 
#> V30
#>   mean           0.5698  0.5836
#>   std. dev.       0.214  0.2299
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V31
#>   mean           0.4891  0.5373
#>   std. dev.      0.2227  0.2021
#>   weight sum         76      63
#>   precision      0.0063  0.0063
#> 
#> V32
#>   mean           0.4332   0.468
#>   std. dev.      0.2119  0.2083
#>   weight sum         76      63
#>   precision      0.0065  0.0065
#> 
#> V33
#>   mean           0.3848  0.4583
#>   std. dev.      0.1804   0.223
#>   weight sum         76      63
#>   precision      0.0068  0.0068
#> 
#> V34
#>   mean           0.3491  0.4593
#>   std. dev.      0.1787  0.2717
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V35
#>   mean           0.3087   0.472
#>   std. dev.      0.2203  0.2763
#>   weight sum         76      63
#>   precision      0.0071  0.0071
#> 
#> V36
#>   mean           0.2844  0.4823
#>   std. dev.      0.2291  0.2609
#>   weight sum         76      63
#>   precision      0.0072  0.0072
#> 
#> V37
#>   mean           0.2878  0.4147
#>   std. dev.      0.2042  0.2455
#>   weight sum         76      63
#>   precision      0.0066  0.0066
#> 
#> V38
#>   mean           0.3022  0.3551
#>   std. dev.      0.1739  0.2288
#>   weight sum         76      63
#>   precision      0.0071  0.0071
#> 
#> V39
#>   mean           0.3155  0.3256
#>   std. dev.      0.1702  0.2214
#>   weight sum         76      63
#>   precision      0.0069  0.0069
#> 
#> V4
#>   mean           0.0582  0.0452
#>   std. dev.      0.0403  0.0331
#>   weight sum         76      63
#>   precision       0.002   0.002
#> 
#> V40
#>   mean           0.2916  0.3293
#>   std. dev.      0.1564  0.2035
#>   weight sum         76      63
#>   precision      0.0067  0.0067
#> 
#> V41
#>   mean             0.28  0.2962
#>   std. dev.      0.1689  0.1879
#>   weight sum         76      63
#>   precision      0.0063  0.0063
#> 
#> V42
#>   mean           0.2984  0.2718
#>   std. dev.      0.1751  0.1712
#>   weight sum         76      63
#>   precision      0.0058  0.0058
#> 
#> V43
#>   mean           0.2862   0.233
#>   std. dev.      0.1399  0.1307
#>   weight sum         76      63
#>   precision      0.0056  0.0056
#> 
#> V44
#>   mean           0.2528  0.1824
#>   std. dev.      0.1457  0.1102
#>   weight sum         76      63
#>   precision      0.0057  0.0057
#> 
#> V45
#>   mean           0.2506  0.1379
#>   std. dev.      0.1757  0.0925
#>   weight sum         76      63
#>   precision      0.0051  0.0051
#> 
#> V46
#>   mean           0.2046  0.1123
#>   std. dev.      0.1569  0.0939
#>   weight sum         76      63
#>   precision      0.0054  0.0054
#> 
#> V47
#>   mean            0.149  0.0908
#>   std. dev.      0.0967  0.0683
#>   weight sum         76      63
#>   precision      0.0041  0.0041
#> 
#> V48
#>   mean           0.1091    0.07
#>   std. dev.      0.0658  0.0488
#>   weight sum         76      63
#>   precision      0.0024  0.0024
#> 
#> V49
#>   mean            0.063  0.0386
#>   std. dev.      0.0353  0.0304
#>   weight sum         76      63
#>   precision      0.0015  0.0015
#> 
#> V5
#>   mean           0.0822  0.0646
#>   std. dev.      0.0543  0.0494
#>   weight sum         76      63
#>   precision      0.0024  0.0024
#> 
#> V50
#>   mean           0.0224  0.0181
#>   std. dev.      0.0141  0.0135
#>   weight sum         76      63
#>   precision      0.0007  0.0007
#> 
#> V51
#>   mean           0.0197  0.0142
#>   std. dev.      0.0129  0.0092
#>   weight sum         76      63
#>   precision      0.0008  0.0008
#> 
#> V52
#>   mean           0.0155  0.0117
#>   std. dev.      0.0109  0.0077
#>   weight sum         76      63
#>   precision      0.0006  0.0006
#> 
#> V53
#>   mean           0.0116    0.01
#>   std. dev.      0.0079  0.0064
#>   weight sum         76      63
#>   precision      0.0003  0.0003
#> 
#> V54
#>   mean           0.0115  0.0101
#>   std. dev.      0.0073  0.0054
#>   weight sum         76      63
#>   precision      0.0003  0.0003
#> 
#> V55
#>   mean           0.0103  0.0087
#>   std. dev.      0.0086  0.0048
#>   weight sum         76      63
#>   precision      0.0004  0.0004
#> 
#> V56
#>   mean           0.0086  0.0074
#>   std. dev.      0.0063  0.0045
#>   weight sum         76      63
#>   precision      0.0004  0.0004
#> 
#> V57
#>   mean           0.0079  0.0075
#>   std. dev.      0.0063   0.005
#>   weight sum         76      63
#>   precision      0.0004  0.0004
#> 
#> V58
#>   mean            0.009  0.0075
#>   std. dev.      0.0081  0.0051
#>   weight sum         76      63
#>   precision      0.0005  0.0005
#> 
#> V59
#>   mean           0.0082  0.0074
#>   std. dev.      0.0065  0.0053
#>   weight sum         76      63
#>   precision      0.0003  0.0003
#> 
#> V6
#>   mean           0.1127   0.099
#>   std. dev.      0.0511  0.0673
#>   weight sum         76      63
#>   precision      0.0028  0.0028
#> 
#> V60
#>   mean            0.007  0.0063
#>   std. dev.      0.0061  0.0038
#>   weight sum         76      63
#>   precision      0.0005  0.0005
#> 
#> V7
#>   mean           0.1243  0.1159
#>   std. dev.      0.0499  0.0685
#>   weight sum         76      63
#>   precision      0.0029  0.0029
#> 
#> V8
#>   mean           0.1476  0.1185
#>   std. dev.      0.0756  0.0784
#>   weight sum         76      63
#>   precision      0.0031  0.0031
#> 
#> V9
#>   mean           0.2053  0.1355
#>   std. dev.      0.1048  0.1003
#>   weight sum         76      63
#>   precision      0.0049  0.0049
#> 
#> 


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

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