Classification Stochastic Gradient Descent Learner
mlr_learners_classif.sgd.Rd
Stochastic Gradient Descent for learning various linear models.
Calls RWeka::make_Weka_classifier()
from RWeka.
Initial parameter values
F
:Has only 2 out of 5 original loss functions: 0 = hinge loss (SVM) and 1 = log loss (logistic regression) with 0 (hinge loss) still being the default
Reason for change: this learner should only contain loss functions appropriate for classification tasks
Custom mlr3 parameters
output_debug_info
:original id: output-debug-info
do_not_check_capabilities
:original id: do-not-check-capabilities
num_decimal_places
:original id: num-decimal-places
batch_size
:original id: batch-size
Reason for change: This learner contains changed ids of the following control arguments since their ids contain irregular pattern
Parameters
Id | Type | Default | Levels | Range |
subset | untyped | - | - | |
na.action | untyped | - | - | |
F | character | 0 | 0, 1 | - |
L | numeric | 0.01 | \((-\infty, \infty)\) | |
R | numeric | 1e-04 | \((-\infty, \infty)\) | |
E | integer | 500 | \((-\infty, \infty)\) | |
C | numeric | 0.001 | \((-\infty, \infty)\) | |
N | logical | - | TRUE, FALSE | - |
M | logical | - | TRUE, FALSE | - |
S | integer | 1 | \((-\infty, \infty)\) | |
output_debug_info | logical | FALSE | TRUE, FALSE | - |
do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
num_decimal_places | integer | 2 | \([1, \infty)\) | |
batch_size | integer | 100 | \([1, \infty)\) | |
options | untyped | NULL | - |
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
-> LearnerClassifSGD
Examples
# Define the Learner
learner = mlr3::lrn("classif.sgd")
print(learner)
#> <LearnerClassifSGD:classif.sgd>: Stochastic Gradient Descent
#> * Model: -
#> * Parameters: F=0
#> * Packages: mlr3, RWeka
#> * Predict Types: [response], prob
#> * Feature Types: logical, integer, numeric, factor, ordered
#> * Properties: missings, twoclass
# Define a Task
task = mlr3::tsk("sonar")
# Create train and test set
ids = mlr3::partition(task)
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
print(learner$model)
#> Loss function: Hinge loss (SVM)
#>
#> Class =
#>
#> 0.3078 (normalized) V1
#> + -0.9122 (normalized) V10
#> + -2.2551 (normalized) V11
#> + -3.2274 (normalized) V12
#> + 0.5243 (normalized) V13
#> + 1.4039 (normalized) V14
#> + 1.5682 (normalized) V15
#> + 0.7261 (normalized) V16
#> + -0.6679 (normalized) V17
#> + -1.3754 (normalized) V18
#> + -0.188 (normalized) V19
#> + 0.9913 (normalized) V2
#> + 0.0557 (normalized) V20
#> + -0.1367 (normalized) V21
#> + -0.3607 (normalized) V22
#> + -1.2215 (normalized) V23
#> + -0.0225 (normalized) V24
#> + 0.7655 (normalized) V25
#> + 0.2679 (normalized) V26
#> + 1.2847 (normalized) V27
#> + -0.856 (normalized) V28
#> + -0.491 (normalized) V29
#> + 0.1165 (normalized) V3
#> + -2.5084 (normalized) V30
#> + 2.447 (normalized) V31
#> + 0.7205 (normalized) V32
#> + -0.1017 (normalized) V33
#> + 1.1714 (normalized) V34
#> + -0.8282 (normalized) V35
#> + 2.2266 (normalized) V36
#> + 3.8013 (normalized) V37
#> + -1.8417 (normalized) V38
#> + -1.2393 (normalized) V39
#> + -3.3124 (normalized) V4
#> + 2.9488 (normalized) V40
#> + -2.3228 (normalized) V41
#> + -0.7068 (normalized) V42
#> + -1.6756 (normalized) V43
#> + -1.4499 (normalized) V44
#> + -2.673 (normalized) V45
#> + 0.2482 (normalized) V46
#> + 1.5725 (normalized) V47
#> + -0.341 (normalized) V48
#> + -2.8914 (normalized) V49
#> + 0.5567 (normalized) V5
#> + 2.4572 (normalized) V50
#> + -0.5679 (normalized) V51
#> + -0.8752 (normalized) V52
#> + 0.1496 (normalized) V53
#> + -2.5071 (normalized) V54
#> + 2.2617 (normalized) V55
#> + 0.0745 (normalized) V56
#> + 0.4542 (normalized) V57
#> + -0.9053 (normalized) V58
#> + -1.467 (normalized) V59
#> + 0.8816 (normalized) V6
#> + 1.2217 (normalized) V60
#> + 2.3967 (normalized) V7
#> + 0.2814 (normalized) V8
#> + -1.8243 (normalized) V9
#> + 2.26
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.3768116