Skip to contents

Quadratic discriminant analysis. Calls MASS::qda() from package MASS.

Details

Parameters method and prior exist for training and prediction but accept different values for each. Therefore, arguments for the predict stage have been renamed to predict.method and predict.prior, respectively.

Dictionary

This Learner can be instantiated via the dictionary mlr_learners or with the associated sugar function lrn():

mlr_learners$get("classif.qda")
lrn("classif.qda")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

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

  • Required Packages: mlr3, mlr3learners, MASS

Parameters

IdTypeDefaultLevelsRange
methodcharactermomentmoment, mle, mve, t-
nuinteger-\((-\infty, \infty)\)
predict.methodcharacterplug-inplug-in, predictive, debiased-
predict.prioruntyped--
prioruntyped--

References

Venables WN, Ripley BD (2002). Modern Applied Statistics with S, Fourth edition. Springer, New York. ISBN 0-387-95457-0, http://www.stats.ox.ac.uk/pub/MASS4/.

See also

Other Learner: mlr_learners_classif.cv_glmnet, mlr_learners_classif.glmnet, mlr_learners_classif.kknn, mlr_learners_classif.lda, mlr_learners_classif.log_reg, mlr_learners_classif.multinom, mlr_learners_classif.naive_bayes, mlr_learners_classif.nnet, mlr_learners_classif.ranger, mlr_learners_classif.svm, mlr_learners_classif.xgboost, mlr_learners_regr.cv_glmnet, mlr_learners_regr.glmnet, mlr_learners_regr.kknn, mlr_learners_regr.km, mlr_learners_regr.lm, mlr_learners_regr.nnet, mlr_learners_regr.ranger, mlr_learners_regr.svm, mlr_learners_regr.xgboost

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifQDA

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifQDA$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (requireNamespace("MASS", quietly = TRUE)) {
# Define the Learner and set parameter values
learner = lrn("classif.qda")
print(learner)

# 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 the model
print(learner$model)

# importance method
if("importance" %in% learner$properties) print(learner$importance)

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

# Score the predictions
predictions$score()
}
#> <LearnerClassifQDA:classif.qda>: Quadratic Discriminant Analysis
#> * Model: -
#> * Parameters: list()
#> * Packages: mlr3, mlr3learners, MASS
#> * Predict Types:  [response], prob
#> * Feature Types: logical, integer, numeric, factor, ordered
#> * Properties: multiclass, twoclass, weights
#> Call:
#> qda(task$formula(), data = task$data())
#> 
#> Prior probabilities of groups:
#>         M         R 
#> 0.5323741 0.4676259 
#> 
#> Group means:
#>           V1       V10       V11       V12       V13       V14       V15
#> M 0.03619324 0.2545946 0.3015676 0.3157905 0.3319176 0.3367135 0.3288068
#> R 0.02219231 0.1656077 0.1796077 0.1932785 0.2309569 0.2573123 0.2943462
#>         V16       V17       V18       V19         V2       V20       V21
#> M 0.3784311 0.4121257 0.4518689 0.5300432 0.04934459 0.6104676 0.6626743
#> R 0.3662723 0.4048708 0.4311231 0.4490308 0.03178154 0.4882169 0.5337554
#>         V22       V23       V24       V25       V26       V27       V28
#> M 0.6763797 0.6842838 0.6999419 0.6944811 0.7217284 0.7358797 0.7394878
#> R 0.5596092 0.5990031 0.6478846 0.6591477 0.6787846 0.6812123 0.6927200
#>         V29         V3       V30       V31       V32       V33       V34
#> M 0.6708541 0.05347568 0.5862689 0.4881959 0.4268838 0.3973500 0.3709973
#> R 0.6591046 0.03754769 0.6042185 0.5499554 0.4671815 0.4427077 0.4466585
#>         V35       V36       V37       V38       V39         V4       V40
#> M 0.3443959 0.3198486 0.3133662 0.3327351 0.3507784 0.06829459 0.3070527
#> R 0.4610308 0.4655292 0.4160785 0.3634015 0.3253585 0.04453385 0.3099369
#>         V41       V42      V43       V44       V45       V46        V47
#> M 0.2912176 0.3009554 0.284823 0.2532865 0.2519216 0.1992649 0.13933919
#> R 0.2755138 0.2356600 0.209240 0.1756385 0.1425154 0.1177154 0.09508154
#>          V48        V49         V5        V50        V51        V52         V53
#> M 0.10853649 0.06522973 0.09554459 0.02360135 0.01861486 0.01548108 0.011572973
#> R 0.06790615 0.03753538 0.06412769 0.01828462 0.01277385 0.01069692 0.009632308
#>           V54         V55         V56         V57         V58         V59
#> M 0.011716216 0.010256757 0.008855405 0.007754054 0.008843243 0.008513514
#> R 0.009543077 0.008926154 0.007932308 0.008049231 0.007035385 0.007030769
#>          V6         V60        V7        V8        V9
#> M 0.1119135 0.006475676 0.1227689 0.1522216 0.2137203
#> R 0.1004846 0.005970769 0.1183323 0.1216846 0.1463523
#> classif.ce 
#>  0.3913043