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.3749 (normalized) V1
#> + -0.0353 (normalized) V10
#> + -2.4726 (normalized) V11
#> + -3.0281 (normalized) V12
#> + -0.2391 (normalized) V13
#> + 1.8267 (normalized) V14
#> + 1.0585 (normalized) V15
#> + -0.1364 (normalized) V16
#> + 0.5481 (normalized) V17
#> + 1.2435 (normalized) V18
#> + -0.6708 (normalized) V19
#> + -0.3966 (normalized) V2
#> + -0.4796 (normalized) V20
#> + 0.0809 (normalized) V21
#> + -0.8816 (normalized) V22
#> + -1.5598 (normalized) V23
#> + -0.7134 (normalized) V24
#> + -0.2671 (normalized) V25
#> + 1.1503 (normalized) V26
#> + 0.9717 (normalized) V27
#> + -1.5217 (normalized) V28
#> + 0.4245 (normalized) V29
#> + 0.4409 (normalized) V3
#> + -2.5413 (normalized) V30
#> + 3.0694 (normalized) V31
#> + 0.3071 (normalized) V32
#> + -1.1687 (normalized) V33
#> + 0.088 (normalized) V34
#> + 0.32 (normalized) V35
#> + 1.9799 (normalized) V36
#> + 1.0085 (normalized) V37
#> + -2.1819 (normalized) V38
#> + -1.4745 (normalized) V39
#> + -2.6017 (normalized) V4
#> + 3.3279 (normalized) V40
#> + 0.0356 (normalized) V41
#> + -0.5185 (normalized) V42
#> + 0.0783 (normalized) V43
#> + -0.4834 (normalized) V44
#> + -2.5823 (normalized) V45
#> + 0.2793 (normalized) V46
#> + -0.0509 (normalized) V47
#> + -1.7598 (normalized) V48
#> + -2.069 (normalized) V49
#> + -1.6261 (normalized) V5
#> + 2.7246 (normalized) V50
#> + -2.2303 (normalized) V51
#> + -4.0937 (normalized) V52
#> + -0.7006 (normalized) V53
#> + 0.2595 (normalized) V54
#> + 1.4555 (normalized) V55
#> + 0.0828 (normalized) V56
#> + 0.13 (normalized) V57
#> + -1.3913 (normalized) V58
#> + -0.8182 (normalized) V59
#> + -0.4869 (normalized) V6
#> + 1.0682 (normalized) V60
#> + 1.7649 (normalized) V7
#> + 0.0074 (normalized) V8
#> + -0.745 (normalized) V9
#> + 3.71
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2173913