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 =
#>
#> -1.8364 (normalized) V1
#> + -2.4592 (normalized) V10
#> + -2.4149 (normalized) V11
#> + -2.208 (normalized) V12
#> + -1.3978 (normalized) V13
#> + 0.8752 (normalized) V14
#> + 2.416 (normalized) V15
#> + 2.0113 (normalized) V16
#> + 1.2338 (normalized) V17
#> + -0.3052 (normalized) V18
#> + 0.065 (normalized) V19
#> + 1.0214 (normalized) V2
#> + -1.1767 (normalized) V20
#> + -1.8991 (normalized) V21
#> + 0.2453 (normalized) V22
#> + -1.0103 (normalized) V23
#> + -1.3608 (normalized) V24
#> + 2.1957 (normalized) V25
#> + 1.3272 (normalized) V26
#> + -1.4977 (normalized) V27
#> + -0.1202 (normalized) V28
#> + -0.7464 (normalized) V29
#> + 0.8049 (normalized) V3
#> + -1.2014 (normalized) V30
#> + 2.8644 (normalized) V31
#> + -0.0175 (normalized) V32
#> + 0.0792 (normalized) V33
#> + 0.7614 (normalized) V34
#> + 0.1232 (normalized) V35
#> + 1.6079 (normalized) V36
#> + 2.8102 (normalized) V37
#> + 0.8092 (normalized) V38
#> + -0.4755 (normalized) V39
#> + -1.1267 (normalized) V4
#> + 2.8002 (normalized) V40
#> + -0.8268 (normalized) V41
#> + -1.4015 (normalized) V42
#> + -0.883 (normalized) V43
#> + -2.1613 (normalized) V44
#> + -1.911 (normalized) V45
#> + -0.5479 (normalized) V46
#> + -0.6379 (normalized) V47
#> + -2.0551 (normalized) V48
#> + -2.7798 (normalized) V49
#> + -1.7746 (normalized) V5
#> + 2.7179 (normalized) V50
#> + -1.2766 (normalized) V51
#> + -1.1275 (normalized) V52
#> + 0.8262 (normalized) V53
#> + -2.2477 (normalized) V54
#> + 2.2565 (normalized) V55
#> + 0.6704 (normalized) V56
#> + 2.2754 (normalized) V57
#> + -0.4292 (normalized) V58
#> + -3.3463 (normalized) V59
#> + 0.607 (normalized) V6
#> + -0.7761 (normalized) V60
#> + 2.3764 (normalized) V7
#> + 2.0814 (normalized) V8
#> + -1.9127 (normalized) V9
#> + 2.22
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2608696