Quadratic Discriminant Analysis Classification Learner
Source:R/LearnerClassifQDA.R
mlr_learners_classif.qda.Rd
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 mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn()
:
Meta Information
Task type: “classif”
Predict Types: “response”, “prob”
Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”
Required Packages: mlr3, mlr3learners, MASS
Parameters
Id | Type | Default | Levels | Range |
method | character | moment | moment, mle, mve, t | - |
nu | integer | - | \((-\infty, \infty)\) | |
predict.method | character | plug-in | plug-in, predictive, debiased | - |
predict.prior | untyped | - | - | |
prior | untyped | - | - |
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
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners)
for a table of available Learners in the running session (depending on the loaded packages).mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
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
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.5467626 0.4532374
#>
#> Group means:
#> V1 V10 V11 V12 V13 V14 V15
#> M 0.03695789 0.2530645 0.2926500 0.2950513 0.3143513 0.3260289 0.3438368
#> R 0.02142857 0.1508635 0.1662968 0.1801683 0.2220095 0.2510492 0.2852016
#> V16 V17 V18 V19 V2 V20 V21
#> M 0.3880829 0.4216592 0.4541868 0.5251434 0.04836053 0.6101474 0.6707592
#> R 0.3511127 0.3870873 0.4263571 0.4429921 0.02782857 0.4890063 0.5484762
#> V22 V23 V24 V25 V26 V27 V28
#> M 0.6607947 0.6540829 0.6697421 0.6653105 0.6938342 0.6941026 0.7033684
#> R 0.5660730 0.6081571 0.6668333 0.6860429 0.7030937 0.7018079 0.6975873
#> V29 V3 V30 V31 V32 V33 V34
#> M 0.6515776 0.05545526 0.5902329 0.4798132 0.4287382 0.3997329 0.3712829
#> R 0.6587063 0.03294603 0.5855429 0.5102556 0.4251968 0.4389365 0.4470968
#> V35 V36 V37 V38 V39 V4 V40
#> M 0.3550553 0.3400329 0.3254553 0.3410303 0.3417224 0.07388158 0.3035711
#> R 0.4568794 0.4538587 0.3979254 0.3297492 0.2964762 0.04109206 0.3129460
#> V41 V42 V43 V44 V45 V46 V47
#> M 0.2886816 0.2940092 0.2646237 0.2408276 0.2472868 0.1962053 0.1417316
#> R 0.2892429 0.2552270 0.2103667 0.1648810 0.1346921 0.1118000 0.0875000
#> V48 V49 V5 V50 V51 V52 V53
#> M 0.10839079 0.06232237 0.09072763 0.02162895 0.02020395 0.01690921 0.012292105
#> R 0.06727619 0.03707778 0.06094127 0.01745238 0.01138254 0.00967619 0.009249206
#> V54 V55 V56 V57 V58 V59
#> M 0.01222368 0.010247368 0.009053947 0.008336842 0.009419737 0.009213158
#> R 0.00987619 0.008638095 0.007193651 0.007939683 0.006093651 0.006473016
#> V6 V60 V7 V8 V9
#> M 0.1185855 0.007480263 0.1344053 0.1589842 0.2191711
#> R 0.0971746 0.005744444 0.1140365 0.1131921 0.1324000
#> classif.ce
#> 0.4202899