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

print(learner$model)
#> $regularization
#>       lambda   lambda.var lambda.freqs 
#>   0.10681114   0.02232994   1.00000000 
#> 
#> $freqs
#>   M   R 
#> 0.5 0.5 
#> 
#> $alpha
#>         M         R 
#> -4.705432  2.107602 
#> 
#> $beta
#>          V1        V10       V11       V12       V13        V14         V15
#> M  2.679348  0.6978864  1.713413  1.854407  1.734366  0.1869156 -0.03188255
#> R -2.679348 -0.6978864 -1.713413 -1.854407 -1.734366 -0.1869156  0.03188255
#>         V16       V17         V18        V19        V2      V20       V21
#> M -1.070842 -1.321056 -0.06611647  0.8704691 -1.705445  0.20969  0.823231
#> R  1.070842  1.321056  0.06611647 -0.8704691  1.705445 -0.20969 -0.823231
#>         V22        V23        V24        V25        V26       V27       V28
#> M  0.896763  0.4558563  0.4432555 -0.8788303 -0.7452515  0.132725  1.144788
#> R -0.896763 -0.4558563 -0.4432555  0.8788303  0.7452515 -0.132725 -1.144788
#>          V29        V3        V30       V31      V32        V33        V34
#> M -0.1600363 -5.994905  0.4094175 -1.579523  1.41346 -0.1056821 -0.7992412
#> R  0.1600363  5.994905 -0.4094175  1.579523 -1.41346  0.1056821  0.7992412
#>         V35       V36        V37       V38         V39        V4      V40
#> M  1.077116 -1.648136 -0.3294781  0.875727  0.06293901  9.660354 -2.03327
#> R -1.077116  1.648136  0.3294781 -0.875727 -0.06293901 -9.660354  2.03327
#>          V41       V42      V43         V44        V45       V46       V47
#> M  0.2175727 -1.258125  2.28371 -0.01204562  0.7383798  1.822213  2.999243
#> R -0.2175727  1.258125 -2.28371  0.01204562 -0.7383798 -1.822213 -2.999243
#>         V48       V49         V5       V50       V51        V52       V53
#> M  6.689487  9.576705  0.3466086 -18.63417 -6.156326  0.9069582  2.527949
#> R -6.689487 -9.576705 -0.3466086  18.63417  6.156326 -0.9069582 -2.527949
#>         V54       V55        V56       V57       V58       V59         V6
#> M -1.488254 -10.45784 -0.2757738 -1.288188 -3.857884  3.387145 -0.7923561
#> R  1.488254  10.45784  0.2757738  1.288188  3.857884 -3.387145  0.7923561
#>         V60         V7        V8        V9
#> M -2.541793  0.5911045 -2.154509  2.209904
#> R  2.541793 -0.5911045  2.154509 -2.209904
#> 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.2173913