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


Method new()

Creates a new instance of this R6 class.

Usage


Method 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'

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

print(learner$model)
#> $regularization
#>       lambda   lambda.var lambda.freqs 
#>   0.11267965   0.02129866   1.00000000 
#> 
#> $freqs
#>   M   R 
#> 0.5 0.5 
#> 
#> $alpha
#>          M          R 
#> -2.8556388 -0.1672204 
#> 
#> $beta
#>          V1       V10       V11       V12        V13       V14        V15
#> M  4.999431  1.937673  2.404084  3.337852  0.7031963 -2.556623 -0.7972438
#> R -4.999431 -1.937673 -2.404084 -3.337852 -0.7031963  2.556623  0.7972438
#>         V16       V17        V18         V19        V2        V20        V21
#> M -1.858552 -0.407272  0.6474427 -0.09211405  2.506082  0.6314781  0.8516162
#> R  1.858552  0.407272 -0.6474427  0.09211405 -2.506082 -0.6314781 -0.8516162
#>          V22       V23       V24       V25       V26        V27        V28
#> M  0.1360707  1.258802  1.629285 -1.240859 -1.217474 -0.2232355 -0.6078952
#> R -0.1360707 -1.258802 -1.629285  1.240859  1.217474  0.2232355  0.6078952
#>          V29        V3       V30       V31        V32        V33       V34
#> M -0.3074148 -5.624543  2.098803 -1.738686 -0.8558517 -0.2864406 -1.215803
#> R  0.3074148  5.624543 -2.098803  1.738686  0.8558517  0.2864406  1.215803
#>          V35       V36       V37       V38       V39        V4       V40
#> M  0.3094146 -1.609466 -2.547517  1.216007  1.401871  4.312386 -2.720573
#> R -0.3094146  1.609466  2.547517 -1.216007 -1.401871 -4.312386  2.720573
#>         V41        V42       V43      V44       V45      V46       V47
#> M  1.333003 -0.3803823  2.159334  1.24491  1.442108  3.72763  2.776398
#> R -1.333003  0.3803823 -2.159334 -1.24491 -1.442108 -3.72763 -2.776398
#>         V48    V49        V5       V50       V51       V52        V53       V54
#> M -1.228334  10.32  5.730305 -20.00967 -5.894276 -9.375096 -0.1063777  2.898305
#> R  1.228334 -10.32 -5.730305  20.00967  5.894276  9.375096  0.1063777 -2.898305
#>         V55       V56       V57       V58       V59       V6       V60
#> M -12.46157  4.459765 -5.217777 -3.863221  13.44334  4.24373 -10.63076
#> R  12.46157 -4.459765  5.217777  3.863221 -13.44334 -4.24373  10.63076
#>          V7        V8        V9
#> M -1.906875 -3.119802  1.818349
#> R  1.906875  3.119802 -1.818349
#> 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