Skip to contents

Shrinkage Discriminant Analysis for classification. Calls sda::sda() from sda.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.sda")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “integer”, “numeric”

  • Required Packages: mlr3, sda

Parameters

IdTypeDefaultLevelsRange
lambdanumeric-\([0, 1]\)
lambda.varnumeric-\([0, 1]\)
lambda.freqsnumeric-\([0, 1]\)
diagonallogicalFALSETRUE, FALSE-
verboselogicalFALSETRUE, 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

Author

annanzrv

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifSda

Methods

Inherited methods


LearnerClassifSda$new()

Creates a new instance of this R6 class.

Usage


LearnerClassifSda$clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifSda$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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.0241 
#> 
#> 
#> Computing inverse correlation matrix (pooled across classes)
#> Estimating optimal shrinkage intensity lambda (correlation matrix): 0.1209 

print(learner$model)
#> $regularization
#>       lambda   lambda.var lambda.freqs 
#>   0.12090484   0.02409163   1.00000000 
#> 
#> $freqs
#>   M   R 
#> 0.5 0.5 
#> 
#> $alpha
#>          M          R 
#> -3.6020172  0.9699551 
#> 
#> $beta
#>           V1        V10       V11       V12        V13         V14        V15
#> M  0.2110578  0.3622361  2.103679  3.181854  0.3642194  0.03193416 -0.3658611
#> R -0.2110578 -0.3622361 -2.103679 -3.181854 -0.3642194 -0.03193416  0.3658611
#>         V16        V17       V18       V19        V2        V20        V21
#> M -1.363614 -0.8853374  1.144335  1.018478  6.040894  0.6123798 -0.2410535
#> R  1.363614  0.8853374 -1.144335 -1.018478 -6.040894 -0.6123798  0.2410535
#>           V22       V23       V24        V25        V26        V27        V28
#> M  0.03972903  1.093327  0.969219 -0.7563911 -0.7554088  0.1746659  0.5077392
#> R -0.03972903 -1.093327 -0.969219  0.7563911  0.7554088 -0.1746659 -0.5077392
#>          V29        V3        V30       V31       V32         V33       V34
#> M -0.4808506 -8.516373  0.7598545 -1.161007  1.152809  0.06280339 -1.301012
#> R  0.4808506  8.516373 -0.7598545  1.161007 -1.152809 -0.06280339  1.301012
#>          V35       V36       V37        V38        V39        V4       V40
#> M  0.4620731 -1.381852 -1.679057  0.2442274  0.7465476  9.507658 -1.263087
#> R -0.4620731  1.381852  1.679057 -0.2442274 -0.7465476 -9.507658  1.263087
#>           V41        V42       V43         V44      V45        V46       V47
#> M  0.08872685  0.3677293  1.393929  0.05848474  1.22508  0.8484076  3.779716
#> R -0.08872685 -0.3677293 -1.393929 -0.05848474 -1.22508 -0.8484076 -3.779716
#>         V48       V49         V5       V50       V51       V52        V53
#> M  2.476098  3.854167 -0.8005742 -6.318652 -4.328546 -2.970096  0.7007029
#> R -2.476098 -3.854167  0.8005742  6.318652  4.328546  2.970096 -0.7007029
#>         V54       V55       V56      V57       V58       V59        V6
#> M -2.986341 -9.373098  4.673262  5.47843  3.074361  6.828292 -2.151896
#> R  2.986341  9.373098 -4.673262 -5.47843 -3.074361 -6.828292  2.151896
#>         V60      V7        V8        V9
#> M -4.481905 -3.2354 -2.063734  1.847488
#> R  4.481905  3.2354  2.063734 -1.847488
#> 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.3188406