Classification Logistic Regression Learner
Source:R/learner_stepPlr_classif_plr.R
mlr_learners_classif.stepPlr.RdLogistic regression with a quadratic penalization on the coefficient.
Calls stepPlr::plr() from stepPlr.
Parameters
| Id | Type | Default | Levels | Range |
| cp | character | aic | aic, bic | - |
| lambda | numeric | 1e-04 | \([0, \infty)\) | |
| offset.coefficients | untyped | - | - | |
| offset.subset | untyped | - | - |
References
Park, Young M, Hastie, Trevor (2007). “Penalized logistic regression for detecting gene interactions.” Biostatistics, 9(1), 30-50. ISSN 1465-4644, doi:10.1093/biostatistics/kxm010 , https://doi.org/10.1093/biostatistics/kxm010.
See also
as.data.table(mlr_learners)for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifStepPlr
Methods
Inherited methods
mlr3::Learner$base_learner()mlr3::Learner$configure()mlr3::Learner$encapsulate()mlr3::Learner$format()mlr3::Learner$help()mlr3::Learner$predict()mlr3::Learner$predict_newdata()mlr3::Learner$print()mlr3::Learner$reset()mlr3::Learner$selected_features()mlr3::Learner$train()mlr3::LearnerClassif$predict_newdata_fast()
Examples
# Define the Learner
learner = lrn("classif.stepPlr")
print(learner)
#>
#> ── <LearnerClassifStepPlr> (classif.stepPlr): Logistic Regression with a L2 Pena
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3 and stepPlr
#> • Predict Types: [response] and prob
#> • Feature Types: logical, integer, and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: twoclass and weights
#> • Other settings: use_weights = 'use'
# 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)
print(learner$model)
#>
#> Call:
#> stepPlr::plr(x = data, y = y)
#>
#> Coefficients:
#> Intercept V1 V10 V11 V12 V13 V14 V15
#> 15.12777 -22.31838 -12.29278 -19.26808 4.12291 -9.93228 4.52480 1.63777
#> V16 V17 V18 V19 V2 V20 V21 V22
#> -14.49242 38.66317 -7.60880 -25.18810 15.67158 11.02897 21.16428 -35.73878
#> V23 V24 V25 V26 V27 V28 V29 V3
#> 24.70639 -27.08435 -3.44801 4.17726 18.68599 -15.08705 12.57616 30.70956
#> V30 V31 V32 V33 V34 V35 V36 V37
#> -36.62645 53.24177 -28.52599 -0.08112 24.29558 -36.13190 46.99043 -29.93758
#> V38 V39 V4 V40 V41 V42 V43 V44
#> 23.77420 -25.36454 -49.47556 20.17793 -2.83963 -5.75048 5.34870 -28.32945
#> V45 V46 V47 V48 V49 V5 V50 V51
#> -13.87774 41.10349 -34.42812 -38.25570 -7.75258 -9.37749 32.97786 -43.86154
#> V52 V53 V54 V55 V56 V57 V58 V59
#> -21.06961 -10.71121 -7.40570 9.79948 -14.75029 13.39657 -12.80551 -14.36016
#> V6 V60 V7 V8 V9
#> -36.23220 -16.57511 61.69011 28.58210 -32.99220
#>
#> Null deviance: 188.17 on 138 degrees of freedom
#> Residual deviance: 6.09 on 95.77 degrees of freedom
#> Score: deviance + 4.9 * df = 219.4
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.3333333