Shrinkage Discriminant Analysis for classification.
Calls sda::sda() from sda.
Parameters
| Id | Type | Default | Levels | Range |
| lambda | numeric | - | \([0, 1]\) | |
| lambda.var | numeric | - | \([0, 1]\) | |
| lambda.freqs | numeric | - | \([0, 1]\) | |
| diagonal | logical | FALSE | TRUE, FALSE | - |
| verbose | logical | FALSE | TRUE, FALSE | - |
References
Ahdesmaeki, Miika, Strimmer, Korbinian (2010). “Feature selection in omics prediction problems using cat scores and false nondiscovery rate control.” The Annals of Applied Statistics, 4(1). ISSN 1932-6157, doi:10.1214/09-aoas277 , http://dx.doi.org/10.1214/09-AOAS277.
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/chapters/chapter2/data_and_basic_modeling.html#sec-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 -> LearnerClassifSda
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()
Examples
# Define the Learner
learner = lrn("classif.sda")
print(learner)
#>
#> ── <LearnerClassifSda> (classif.sda): Shrinkage Discriminant Analysis ──────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3 and sda
#> • Predict Types: [response] and prob
#> • Feature Types: integer and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: 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)
#> Number of variables: 60
#> Number of observations: 139
#> Number of classes: 2
#>
#> Estimating optimal shrinkage intensity lambda.freq (frequencies): 1
#> Estimating variances (pooled across classes)
#> Estimating optimal shrinkage intensity lambda.var (variance vector): 0.0234
#>
#>
#> Computing inverse correlation matrix (pooled across classes)
#> Estimating optimal shrinkage intensity lambda (correlation matrix): 0.1077
print(learner$model)
#> $regularization
#> lambda lambda.var lambda.freqs
#> 0.10766080 0.02343773 1.00000000
#>
#> $freqs
#> M R
#> 0.5 0.5
#>
#> $alpha
#> M R
#> -5.723633 2.948352
#>
#> $beta
#> V1 V10 V11 V12 V13 V14 V15
#> M 4.277793 2.984581 2.128093 1.962358 1.854194 0.8094872 0.317756
#> R -4.277793 -2.984581 -2.128093 -1.962358 -1.854194 -0.8094872 -0.317756
#> V16 V17 V18 V19 V2 V20 V21
#> M -0.5201267 -1.976412 -0.02760296 0.9115067 3.100759 0.7118827 0.3967959
#> R 0.5201267 1.976412 0.02760296 -0.9115067 -3.100759 -0.7118827 -0.3967959
#> V22 V23 V24 V25 V26 V27 V28
#> M 0.4955305 0.4069361 0.3434566 -0.2301356 -0.2849203 0.08527649 1.264475
#> R -0.4955305 -0.4069361 -0.3434566 0.2301356 0.2849203 -0.08527649 -1.264475
#> V29 V3 V30 V31 V32 V33 V34
#> M 0.05342988 -8.720105 0.6148855 -1.949805 1.131313 0.02226864 -0.487248
#> R -0.05342988 8.720105 -0.6148855 1.949805 -1.131313 -0.02226864 0.487248
#> V35 V36 V37 V38 V39 V4 V40
#> M 1.507688 -1.844617 -1.26258 0.8197989 0.4456026 11.04304 -2.602888
#> R -1.507688 1.844617 1.26258 -0.8197989 -0.4456026 -11.04304 2.602888
#> V41 V42 V43 V44 V45 V46 V47
#> M 1.405053 -0.2620887 0.725286 0.8908467 0.2363866 0.3729708 6.326934
#> R -1.405053 0.2620887 -0.725286 -0.8908467 -0.2363866 -0.3729708 -6.326934
#> V48 V49 V5 V50 V51 V52 V53
#> M 3.723393 6.492125 -0.3902493 -6.743991 -12.58651 -2.173735 3.648443
#> R -3.723393 -6.492125 0.3902493 6.743991 12.58651 2.173735 -3.648443
#> V54 V55 V56 V57 V58 V59 V6
#> M 2.587526 -16.94799 -0.06586467 -2.605927 1.858866 5.584141 -0.1463602
#> R -2.587526 16.94799 0.06586467 2.605927 -1.858866 -5.584141 0.1463602
#> V60 V7 V8 V9
#> M 3.683637 -5.295979 -2.048376 1.484484
#> R -3.683637 5.295979 2.048376 -1.484484
#> attr(,"class")
#> [1] "shrinkage"
#>
#> attr(,"class")
#> [1] "sda"
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
#> Prediction uses 60 features.
# Score the predictions
predictions$score()
#> classif.ce
#> 0.3043478