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

print(learner$model)
#> $regularization
#>       lambda   lambda.var lambda.freqs 
#>   0.11550644   0.02206861   1.00000000 
#> 
#> $freqs
#>   M   R 
#> 0.5 0.5 
#> 
#> $alpha
#>          M          R 
#> -3.4899712  0.9234823 
#> 
#> $beta
#>          V1        V10       V11       V12       V13       V14        V15
#> M  1.613181  0.3630886  1.195985  2.309387  1.158414 -1.255626  0.5960914
#> R -1.613181 -0.3630886 -1.195985 -2.309387 -1.158414  1.255626 -0.5960914
#>          V16        V17         V18        V19         V2        V20        V21
#> M -0.5946419 -0.5590371 -0.07152045  0.6668395  0.1376106  0.6013776 -0.2960916
#> R  0.5946419  0.5590371  0.07152045 -0.6668395 -0.1376106 -0.6013776  0.2960916
#>           V22        V23       V24       V25        V26        V27        V28
#> M -0.05631817  0.7896579  1.033974 -1.170898 -0.2194881  0.2662943  0.9361459
#> R  0.05631817 -0.7896579 -1.033974  1.170898  0.2194881 -0.2662943 -0.9361459
#>           V29        V3        V30     V31       V32        V33        V34
#> M -0.09877851 -7.058745  0.9294162 -2.3308 -0.297925  0.3324209 -0.1492491
#> R  0.09877851  7.058745 -0.9294162  2.3308  0.297925 -0.3324209  0.1492491
#>           V35       V36       V37       V38       V39        V4       V40
#> M  0.05335129 -1.509868 -1.427696  1.758113  1.175391  7.905749 -2.926124
#> R -0.05335129  1.509868  1.427696 -1.758113 -1.175391 -7.905749  2.926124
#>          V41         V42      V43        V44       V45       V46       V47
#> M  0.5347241  0.07938156  1.01232  0.5605081  1.656099  3.236031  1.311475
#> R -0.5347241 -0.07938156 -1.01232 -0.5605081 -1.656099 -3.236031 -1.311475
#>         V48       V49        V5       V50       V51      V52        V53
#> M  3.480119  4.105399  2.975617 -15.27016 -4.147226 -6.48156 -0.5329776
#> R -3.480119 -4.105399 -2.975617  15.27016  4.147226  6.48156  0.5329776
#>         V54       V55      V56     V57       V58       V59         V6       V60
#> M  7.128472 -10.86455 -2.89836 -1.3085  2.824125  5.563344 -0.5488737 -2.273745
#> R -7.128472  10.86455  2.89836  1.3085 -2.824125 -5.563344  0.5488737  2.273745
#>          V7        V8       V9
#> M -1.231302 -2.293431  2.32826
#> R  1.231302  2.293431 -2.32826
#> 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