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): 0.615 
#> 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.116 

print(learner$model)
#> $regularization
#>       lambda   lambda.var lambda.freqs 
#>   0.11596423   0.02230039   0.61500805 
#> 
#> $freqs
#>         M         R 
#> 0.5207729 0.4792271 
#> 
#> $alpha
#>         M         R 
#> -3.793624  1.446943 
#> 
#> $beta
#>          V1       V10       V11       V12       V13       V14        V15
#> M  3.274668  1.803759  1.542577  2.157881  2.018618 -1.368774 -0.7760449
#> R -3.558561 -1.960133 -1.676308 -2.344955 -2.193619  1.487438  0.8433230
#>         V16        V17        V18        V19        V2        V20        V21
#> M -1.086226 -0.4211555  0.6372627  0.1066018  4.909973 -0.1167937  0.5145048
#> R  1.180394  0.4576670 -0.6925092 -0.1158435 -5.335636  0.1269189 -0.5591091
#>          V22        V23        V24         V25        V26        V27        V28
#> M  0.4495187  0.6202684  0.3913216  0.01214752 -0.5667764 -0.5866911  0.6554269
#> R -0.4884891 -0.6740417 -0.4252467 -0.01320063  0.6159123  0.6375534 -0.7122481
#>          V29        V3       V30       V31        V32        V33        V34
#> M -0.2294794 -8.064778  1.576066 -2.100844  0.2534030  0.1250338 -0.6730168
#> R  0.2493737  8.763942 -1.712701  2.282973 -0.2753715 -0.1358734  0.7313630
#>          V35       V36        V37       V38       V39        V4       V40
#> M  0.3523626 -1.925959 -0.6706129  1.549494  1.424294  7.342766 -2.583303
#> R -0.3829101  2.092927  0.7287507 -1.683825 -1.547771 -7.979336  2.807259
#>          V41       V42        V43        V44       V45       V46       V47
#> M  0.2651940  1.409024  0.2884002  0.1001941  1.091508  1.984819  1.693255
#> R -0.2881846 -1.531177 -0.3134026 -0.1088803 -1.186135 -2.156891 -1.840050
#>         V48       V49         V5       V50       V51        V52       V53
#> M  2.973134  4.198713  0.4634222 -9.758304 -1.657926 -0.9080957 -2.969219
#> R -3.230885 -4.562715 -0.5035979 10.604286  1.801658  0.9868218  3.226631
#>         V54       V55       V56       V57       V58        V59        V6
#> M  4.000653 -11.08711  8.474031 -3.088025 -5.035324  0.4894285  1.311745
#> R -4.347484  12.04829 -9.208675  3.355736  5.471854 -0.5318588 -1.425465
#>           V60         V7        V8        V9
#> M  0.02379010 -0.4278689 -3.651173  2.824012
#> R -0.02585255  0.4649623  3.967706 -3.068835
#> 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