【R vs Python】机器学习

R语言
python
机器学习
R语言(tidymodels 和 mlr3)和python(sklearn)机器学习对比
作者

不止BI

发布于

2024年2月23日

数据集

企鹅数据集(penguins)是一个包含南极洲三种企鹅物种的生物测量数据的公开数据集。该数据集由美国南极洲 Palmer 站的科学家在 1971 年至 2022 年间收集。

  • species: 企鹅物种,取值为 Adelie、Chinstrap 或 Gentoo

  • island: 企鹅栖息的岛屿,取值为 Biscoe、Dream 或 Torgersen

  • sex: 企鹅性别,取值为 male 或 female

  • bill_length_mm: 企鹅喙长(毫米)

  • bill_depth_mm: 企鹅喙深(毫米)

  • flipper_length_mm: 企鹅鳍长(毫米)

  • body_mass_g: 企鹅体重(克)

  • year: 数据收集年份

  • age: 企鹅年龄(年)

代码
library(dplyr)

tb_penguins <-
  read.csv(
    "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv"
  ) %>%
  as_tibble()
head(tb_penguins)
# A tibble: 6 × 7
  species island    bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
  <chr>   <chr>              <dbl>         <dbl>             <int>       <int>
1 Adelie  Torgersen           39.1          18.7               181        3750
2 Adelie  Torgersen           39.5          17.4               186        3800
3 Adelie  Torgersen           40.3          18                 195        3250
4 Adelie  Torgersen           NA            NA                  NA          NA
5 Adelie  Torgersen           36.7          19.3               193        3450
6 Adelie  Torgersen           39.3          20.6               190        3650
# ℹ 1 more variable: sex <chr>
代码
library(data.table)

dt_penguins <- as.data.table(
  read.csv(
    "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv"
  )
)
head(dt_penguins)
   species    island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
    <char>    <char>          <num>         <num>             <int>       <int>
1:  Adelie Torgersen           39.1          18.7               181        3750
2:  Adelie Torgersen           39.5          17.4               186        3800
3:  Adelie Torgersen           40.3          18.0               195        3250
4:  Adelie Torgersen             NA            NA                NA          NA
5:  Adelie Torgersen           36.7          19.3               193        3450
6:  Adelie Torgersen           39.3          20.6               190        3650
      sex
   <char>
1:   MALE
2: FEMALE
3: FEMALE
4:       
5: FEMALE
6:   MALE
代码
import pandas as pd

df_penguins = pd.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv")
df_penguins.head(5)
  species     island  bill_length_mm  ...  flipper_length_mm  body_mass_g     sex
0  Adelie  Torgersen            39.1  ...              181.0       3750.0    MALE
1  Adelie  Torgersen            39.5  ...              186.0       3800.0  FEMALE
2  Adelie  Torgersen            40.3  ...              195.0       3250.0  FEMALE
3  Adelie  Torgersen             NaN  ...                NaN          NaN     NaN
4  Adelie  Torgersen            36.7  ...              193.0       3450.0  FEMALE

[5 rows x 7 columns]

数据可视化

代码
library(GGally)
library(tidyverse)

ggpairs(tb_penguins %>% dplyr::select(ends_with("mm"), species), mapping = ggplot2::aes(color = species))

代码
library(GGally)
ggpairs(tb_penguins, mapping = ggplot2::aes(color = species))

代码
import seaborn as sns
plot1 = sns.pairplot(data = df_penguins,hue = 'species')

基本流程

观察数据

代码
glimpse(tb_penguins)
Rows: 344
Columns: 7
$ species           <chr> "Adelie", "Adelie", "Adelie", "Adelie", "Adelie", "A…
$ island            <chr> "Torgersen", "Torgersen", "Torgersen", "Torgersen", …
$ bill_length_mm    <dbl> 39.1, 39.5, 40.3, NA, 36.7, 39.3, 38.9, 39.2, 34.1, …
$ bill_depth_mm     <dbl> 18.7, 17.4, 18.0, NA, 19.3, 20.6, 17.8, 19.6, 18.1, …
$ flipper_length_mm <int> 181, 186, 195, NA, 193, 190, 181, 195, 193, 190, 186…
$ body_mass_g       <int> 3750, 3800, 3250, NA, 3450, 3650, 3625, 4675, 3475, …
$ sex               <chr> "MALE", "FEMALE", "FEMALE", "", "FEMALE", "MALE", "F…
代码
skimr::skim(data = tb_penguins)
Data summary
Name tb_penguins
Number of rows 344
Number of columns 7
_______________________
Column type frequency:
character 3
numeric 4
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
species 0 1 6 9 0 3 0
island 0 1 5 9 0 3 0
sex 0 1 0 6 11 3 0

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
bill_length_mm 2 0.99 43.92 5.46 32.1 39.23 44.45 48.5 59.6 ▃▇▇▆▁
bill_depth_mm 2 0.99 17.15 1.97 13.1 15.60 17.30 18.7 21.5 ▅▅▇▇▂
flipper_length_mm 2 0.99 200.92 14.06 172.0 190.00 197.00 213.0 231.0 ▂▇▃▅▂
body_mass_g 2 0.99 4201.75 801.95 2700.0 3550.00 4050.00 4750.0 6300.0 ▃▇▆▃▂

数据拆分

代码
library(tidymodels)
set.seed(123)

tb_penguins <- tb_penguins %>%
  mutate(RowId = row_number(), species = factor(species))

# 分层抽样
data_split <- initial_split(tb_penguins, prop = 3 / 4, strata = species)

train_data <- training(data_split)
test_data <- testing(data_split)


# 交叉验证

folds <- vfold_cv(train_data, v = 10, repeats = 10, strata = species)
folds
#  10-fold cross-validation repeated 10 times using stratification 
# A tibble: 100 × 3
   splits           id       id2   
   <list>           <chr>    <chr> 
 1 <split [230/28]> Repeat01 Fold01
 2 <split [231/27]> Repeat01 Fold02
 3 <split [231/27]> Repeat01 Fold03
 4 <split [232/26]> Repeat01 Fold04
 5 <split [233/25]> Repeat01 Fold05
 6 <split [233/25]> Repeat01 Fold06
 7 <split [233/25]> Repeat01 Fold07
 8 <split [233/25]> Repeat01 Fold08
 9 <split [233/25]> Repeat01 Fold09
10 <split [233/25]> Repeat01 Fold10
# ℹ 90 more rows

创建配方

代码
penguins_rec <-
  recipe(species ~ ., data = train_data) %>%
  update_role(RowId, new_role = "ID") %>%
  step_dummy(all_nominal_predictors()) %>%
  step_naomit(all_predictors()) %>%
  step_zv(all_predictors())

创建模型

代码
# 逻辑回归
# lgr_mod <- logistic_reg()

# 随机森林模型,指定参数、计算引擎(即采用的算法包)、计算模式(分类或回归)
rf_mod <-
  rand_forest(trees = 1000) %>%
  set_engine("ranger") %>%
  set_mode("classification")


# 超参数调参
tune_spec <-
  decision_tree(
    cost_complexity = tune(),
    tree_depth = tune()
  ) %>%
  set_engine("rpart") %>%
  set_mode("classification")
tree_grid <- grid_regular(cost_complexity(),
  tree_depth(),
  levels = 5
)

创建工作流

代码
# 包含数据预处理及模型的工作流
penguins_wflow <- workflow() %>%
  add_recipe(penguins_rec) %>%
  add_model(rf_mod)
penguins_wflow
══ Workflow ════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rand_forest()

── Preprocessor ────────────────────────────────────────────────────────────────
3 Recipe Steps

• step_dummy()
• step_naomit()
• step_zv()

── Model ───────────────────────────────────────────────────────────────────────
Random Forest Model Specification (classification)

Main Arguments:
  trees = 1000

Computational engine: ranger 
代码
# 包含数据预处理及模型超参数调参的工作流
penguins_wflow_tune <- workflow() %>%
  add_recipe(penguins_rec) %>%
  add_model(tune_spec)
penguins_wflow_tune
══ Workflow ════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: decision_tree()

── Preprocessor ────────────────────────────────────────────────────────────────
3 Recipe Steps

• step_dummy()
• step_naomit()
• step_zv()

── Model ───────────────────────────────────────────────────────────────────────
Decision Tree Model Specification (classification)

Main Arguments:
  cost_complexity = tune()
  tree_depth = tune()

Computational engine: rpart 

拟合数据

代码
# 直接拟合训练集
penguins_fit <- penguins_wflow %>% fit(train_data)
penguins_fit
══ Workflow [trained] ══════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rand_forest()

── Preprocessor ────────────────────────────────────────────────────────────────
3 Recipe Steps

• step_dummy()
• step_naomit()
• step_zv()

── Model ───────────────────────────────────────────────────────────────────────
Ranger result

Call:
 ranger::ranger(x = maybe_data_frame(x), y = y, num.trees = ~1000,      num.threads = 1, verbose = FALSE, seed = sample.int(10^5,          1), probability = TRUE) 

Type:                             Probability estimation 
Number of trees:                  1000 
Sample size:                      256 
Number of independent variables:  8 
Mtry:                             2 
Target node size:                 10 
Variable importance mode:         none 
Splitrule:                        gini 
OOB prediction error (Brier s.):  0.01671774 
代码
# 交叉验证拟和
penguins_fit_fold <- penguins_wflow %>% fit_resamples(resamples = folds)
collect_metrics(penguins_fit_fold)
# A tibble: 3 × 6
  .metric     .estimator   mean     n  std_err .config             
  <chr>       <chr>       <dbl> <int>    <dbl> <chr>               
1 accuracy    multiclass 0.991     80 0.00194  Preprocessor1_Model1
2 brier_class multiclass 0.0150    80 0.000926 Preprocessor1_Model1
3 roc_auc     hand_till  1.00      80 0.000108 Preprocessor1_Model1
代码
# 调参拟和
penguins_fit_fold_tune <- penguins_wflow_tune %>%
  tune_grid(resamples = folds, grid = tree_grid)
collect_metrics(penguins_fit_fold_tune)
# A tibble: 75 × 8
   cost_complexity tree_depth .metric     .estimator  mean     n std_err .config
             <dbl>      <int> <chr>       <chr>      <dbl> <int>   <dbl> <chr>  
 1    0.0000000001          1 accuracy    multiclass 0.783   100 0.00363 Prepro…
 2    0.0000000001          1 brier_class multiclass 0.158   100 0.00270 Prepro…
 3    0.0000000001          1 roc_auc     hand_till  0.813   100 0.00241 Prepro…
 4    0.0000000178          1 accuracy    multiclass 0.783   100 0.00363 Prepro…
 5    0.0000000178          1 brier_class multiclass 0.158   100 0.00270 Prepro…
 6    0.0000000178          1 roc_auc     hand_till  0.813   100 0.00241 Prepro…
 7    0.00000316            1 accuracy    multiclass 0.783   100 0.00363 Prepro…
 8    0.00000316            1 brier_class multiclass 0.158   100 0.00270 Prepro…
 9    0.00000316            1 roc_auc     hand_till  0.813   100 0.00241 Prepro…
10    0.000562              1 accuracy    multiclass 0.783   100 0.00363 Prepro…
# ℹ 65 more rows

抽取结果

代码
# 抽取模型(随机森林不支持)
# penguins_fit %>%
#   extract_fit_parsnip() %>%
#   tidy()

预测新数据

代码
# 只显示目标变量
penguins_pred <- predict(penguins_fit, test_data)
# 目标变量 与 预测数据结合
penguins_aug <- augment(penguins_fit, test_data)
penguins_aug
# A tibble: 86 × 12
   .pred_class .pred_Adelie .pred_Chinstrap .pred_Gentoo species island   
   <fct>              <dbl>           <dbl>        <dbl> <fct>   <chr>    
 1 Adelie             0.995         0.00250      0.00267 Adelie  Torgersen
 2 Adelie             0.987         0.00968      0.00312 Adelie  Torgersen
 3 Adelie             0.992         0.00517      0.00333 Adelie  Torgersen
 4 Adelie             0.991         0.00677      0.00193 Adelie  Torgersen
 5 Adelie             0.993         0.00201      0.00499 Adelie  Torgersen
 6 Adelie             0.942         0.0375       0.0209  Adelie  Torgersen
 7 Adelie             0.998         0.00127      0.00122 Adelie  Torgersen
 8 Adelie             0.978         0.0133       0.00816 Adelie  Biscoe   
 9 Adelie             0.914         0.0846       0.00149 Adelie  Dream    
10 Adelie             0.887         0.111        0.00214 Adelie  Dream    
# ℹ 76 more rows
# ℹ 6 more variables: bill_length_mm <dbl>, bill_depth_mm <dbl>,
#   flipper_length_mm <int>, body_mass_g <int>, sex <chr>, RowId <int>

模型评价

代码
penguins_aug %>%
  roc_curve(truth = species, .pred_Adelie:.pred_Gentoo) %>%
  autoplot()

代码
penguins_aug %>% roc_auc(truth = species, .pred_Adelie:.pred_Gentoo)
# A tibble: 1 × 3
  .metric .estimator .estimate
  <chr>   <chr>          <dbl>
1 roc_auc hand_till      0.999
代码
penguins_aug %>% accuracy(truth = species, estimate = .pred_class)
# A tibble: 1 × 3
  .metric  .estimator .estimate
  <chr>    <chr>          <dbl>
1 accuracy multiclass     0.988

观察数据

代码
library(mlr3verse)
summary(tb_penguins)
      species       island          bill_length_mm  bill_depth_mm  
 Adelie   :152   Length:344         Min.   :32.10   Min.   :13.10  
 Chinstrap: 68   Class :character   1st Qu.:39.23   1st Qu.:15.60  
 Gentoo   :124   Mode  :character   Median :44.45   Median :17.30  
                                    Mean   :43.92   Mean   :17.15  
                                    3rd Qu.:48.50   3rd Qu.:18.70  
                                    Max.   :59.60   Max.   :21.50  
                                    NA's   :2       NA's   :2      
 flipper_length_mm  body_mass_g       sex                RowId       
 Min.   :172.0     Min.   :2700   Length:344         Min.   :  1.00  
 1st Qu.:190.0     1st Qu.:3550   Class :character   1st Qu.: 86.75  
 Median :197.0     Median :4050   Mode  :character   Median :172.50  
 Mean   :200.9     Mean   :4202                      Mean   :172.50  
 3rd Qu.:213.0     3rd Qu.:4750                      3rd Qu.:258.25  
 Max.   :231.0     Max.   :6300                      Max.   :344.00  
 NA's   :2         NA's   :2                                         

新建学习任务

代码
tsk_penguins <- as_task_classif(tb_penguins, target = "species", id = "penguins")
tsk_penguins
<TaskClassif:penguins> (344 x 8)
* Target: species
* Properties: multiclass
* Features (7):
  - int (3): RowId, body_mass_g, flipper_length_mm
  - dbl (2): bill_depth_mm, bill_length_mm
  - chr (2): island, sex

mlr3中的tsk是一个R6类,可以通过$调取类方法和属性.需要注意的是,tsk类中的方法会直接作用于对象,如果需要保留原始对象,需要使用$clonetsk复制后进行操作

代码
class(tsk_penguins)
[1] "TaskClassif"    "TaskSupervised" "Task"           "R6"            
代码
# 查看列信息
tsk_penguins$col_info
Key: <id>
                  id      type                  levels  label fix_factor_levels
              <char>    <char>                  <list> <char>            <lgcl>
1:          ..row_id   integer                           <NA>             FALSE
2:             RowId   integer                           <NA>             FALSE
3:     bill_depth_mm   numeric                           <NA>             FALSE
4:    bill_length_mm   numeric                           <NA>             FALSE
5:       body_mass_g   integer                           <NA>             FALSE
6: flipper_length_mm   integer                           <NA>             FALSE
7:            island character                           <NA>             FALSE
8:               sex character                           <NA>             FALSE
9:           species    factor Adelie,Chinstrap,Gentoo   <NA>             FALSE
代码
# 查看分类
tsk_penguins$class_names
[1] "Adelie"    "Chinstrap" "Gentoo"   
代码
# 特征名称
tsk_penguins$feature_names
[1] "RowId"             "bill_depth_mm"     "bill_length_mm"   
[4] "body_mass_g"       "flipper_length_mm" "island"           
[7] "sex"              
代码
# 筛选数据(在原始对象)
# tsk_penguins$filter(1:4)
# 筛选数据(在复制对象,原始对象保持不变)
tsk_penguins_clone <- tsk_penguins$clone()
tsk_penguins_clone$filter(1:3)
# 原始对象数据不变
tsk_penguins$data()
     species RowId bill_depth_mm bill_length_mm body_mass_g flipper_length_mm
      <fctr> <int>         <num>          <num>       <int>             <int>
  1:  Adelie     1          18.7           39.1        3750               181
  2:  Adelie     2          17.4           39.5        3800               186
  3:  Adelie     3          18.0           40.3        3250               195
  4:  Adelie     4            NA             NA          NA                NA
  5:  Adelie     5          19.3           36.7        3450               193
 ---                                                                         
340:  Gentoo   340            NA             NA          NA                NA
341:  Gentoo   341          14.3           46.8        4850               215
342:  Gentoo   342          15.7           50.4        5750               222
343:  Gentoo   343          14.8           45.2        5200               212
344:  Gentoo   344          16.1           49.9        5400               213
        island    sex
        <char> <char>
  1: Torgersen   MALE
  2: Torgersen FEMALE
  3: Torgersen FEMALE
  4: Torgersen       
  5: Torgersen FEMALE
 ---                 
340:    Biscoe       
341:    Biscoe FEMALE
342:    Biscoe   MALE
343:    Biscoe FEMALE
344:    Biscoe   MALE
代码
# 复制对象数据已被筛选
tsk_penguins_clone$data()
   species RowId bill_depth_mm bill_length_mm body_mass_g flipper_length_mm
    <fctr> <int>         <num>          <num>       <int>             <int>
1:  Adelie     1          18.7           39.1        3750               181
2:  Adelie     2          17.4           39.5        3800               186
3:  Adelie     3          18.0           40.3        3250               195
      island    sex
      <char> <char>
1: Torgersen   MALE
2: Torgersen FEMALE
3: Torgersen FEMALE

数据拆分

代码
# 拆分训练集与测试集
splits <- partition(tsk_penguins, ratio = 0.75, stratify = TRUE)
splits
$train
  [1]   1   2   4   5   6   8   9  11  12  13  14  15  16  18  19  21  23  26
 [19]  27  28  29  30  31  34  37  38  39  40  42  43  44  46  47  48  49  50
 [37]  51  52  54  55  56  58  59  62  63  64  66  67  68  69  70  71  72  73
 [55]  74  75  76  77  78  79  80  82  84  85  86  87  89  90  91  92  93  94
 [73]  95  96  97  98  99 100 101 102 104 106 107 109 110 111 112 113 114 115
 [91] 116 117 118 122 123 126 127 129 130 131 132 133 134 136 137 138 139 140
[109] 142 143 144 146 147 150 153 155 156 157 159 160 162 164 165 166 168 169
[127] 170 171 172 173 174 175 176 177 178 184 186 187 188 191 192 193 194 195
[145] 196 197 198 199 200 201 202 203 204 206 207 208 209 211 213 214 215 216
[163] 217 218 219 221 222 223 225 226 228 229 230 231 232 234 235 236 238 239
[181] 240 241 243 244 245 246 248 249 250 251 252 253 256 257 258 259 261 262
[199] 263 264 265 267 268 269 270 271 274 275 276 277 278 279 280 281 282 284
[217] 285 286 287 288 289 290 291 293 294 295 296 297 298 299 300 304 306 307
[235] 311 312 313 316 318 319 320 321 322 325 326 328 329 330 332 333 334 336
[253] 337 338 339 341 342 344

$test
 [1]   3   7  10  17  20  22  24  25  32  33  35  36  41  45  53  57  60  61  65
[20]  81  83  88 103 105 108 119 120 121 124 125 128 135 141 145 148 149 151 152
[39] 154 158 161 163 167 179 180 181 182 183 185 189 190 205 210 212 220 224 227
[58] 233 237 242 247 254 255 260 266 272 273 283 292 301 302 303 305 308 309 310
[77] 314 315 317 323 324 327 331 335 340 343
代码
# 交叉验证
resampling <- rsmp("repeated_cv", folds = 10L, repeats = 10)

创建模型

代码
# 查看支持的学习器
lrn()
<DictionaryLearner> with 49 stored values
Keys: classif.cv_glmnet, classif.debug, classif.featureless,
  classif.glmnet, classif.kknn, classif.lda, classif.log_reg,
  classif.multinom, classif.naive_bayes, classif.nnet, classif.qda,
  classif.ranger, classif.rpart, classif.svm, classif.xgboost,
  clust.agnes, clust.ap, clust.cmeans, clust.cobweb, clust.dbscan,
  clust.dbscan_fpc, clust.diana, clust.em, clust.fanny,
  clust.featureless, clust.ff, clust.hclust, clust.hdbscan,
  clust.kkmeans, clust.kmeans, clust.MBatchKMeans, clust.mclust,
  clust.meanshift, clust.optics, clust.pam, clust.SimpleKMeans,
  clust.xmeans, regr.cv_glmnet, regr.debug, regr.featureless,
  regr.glmnet, regr.kknn, regr.km, regr.lm, regr.nnet, regr.ranger,
  regr.rpart, regr.svm, regr.xgboost
代码
# 定义学习器

lrn_ranger <- lrn("classif.ranger")
# 查看学习器参数
lrn_ranger$param_set
<ParamSet>
Key: <id>
                              id    class lower upper nlevels
                          <char>   <char> <num> <num>   <num>
 1:                        alpha ParamDbl  -Inf   Inf     Inf
 2:       always.split.variables ParamUty    NA    NA     Inf
 3:                class.weights ParamUty    NA    NA     Inf
 4:                      holdout ParamLgl    NA    NA       2
 5:                   importance ParamFct    NA    NA       4
 6:                   keep.inbag ParamLgl    NA    NA       2
 7:                    max.depth ParamInt     0   Inf     Inf
 8:                   min.bucket ParamInt     1   Inf     Inf
 9:                min.node.size ParamInt     1   Inf     Inf
10:                      minprop ParamDbl  -Inf   Inf     Inf
11:                         mtry ParamInt     1   Inf     Inf
12:                   mtry.ratio ParamDbl     0     1     Inf
13:                   node.stats ParamLgl    NA    NA       2
14:            num.random.splits ParamInt     1   Inf     Inf
15:                  num.threads ParamInt     1   Inf     Inf
16:                    num.trees ParamInt     1   Inf     Inf
17:                    oob.error ParamLgl    NA    NA       2
18:        regularization.factor ParamUty    NA    NA     Inf
19:      regularization.usedepth ParamLgl    NA    NA       2
20:                      replace ParamLgl    NA    NA       2
21:    respect.unordered.factors ParamFct    NA    NA       3
22:              sample.fraction ParamDbl     0     1     Inf
23:                  save.memory ParamLgl    NA    NA       2
24: scale.permutation.importance ParamLgl    NA    NA       2
25:                    se.method ParamFct    NA    NA       2
26:                         seed ParamInt  -Inf   Inf     Inf
27:         split.select.weights ParamUty    NA    NA     Inf
28:                    splitrule ParamFct    NA    NA       3
29:                      verbose ParamLgl    NA    NA       2
30:                 write.forest ParamLgl    NA    NA       2
                              id    class lower upper nlevels
                                                                                      default
                                                                                       <list>
 1:                                                                                       0.5
 2: <NoDefault>\n  Public:\n    clone: function (deep = FALSE) \n    initialize: function () 
 3:                                                                                          
 4:                                                                                     FALSE
 5: <NoDefault>\n  Public:\n    clone: function (deep = FALSE) \n    initialize: function () 
 6:                                                                                     FALSE
 7:                                                                                          
 8:                                                                                         1
 9:                                                                                          
10:                                                                                       0.1
11: <NoDefault>\n  Public:\n    clone: function (deep = FALSE) \n    initialize: function () 
12: <NoDefault>\n  Public:\n    clone: function (deep = FALSE) \n    initialize: function () 
13:                                                                                     FALSE
14:                                                                                         1
15:                                                                                         1
16:                                                                                       500
17:                                                                                      TRUE
18:                                                                                         1
19:                                                                                     FALSE
20:                                                                                      TRUE
21:                                                                                    ignore
22: <NoDefault>\n  Public:\n    clone: function (deep = FALSE) \n    initialize: function () 
23:                                                                                     FALSE
24:                                                                                     FALSE
25:                                                                                   infjack
26:                                                                                          
27:                                                                                          
28:                                                                                      gini
29:                                                                                      TRUE
30:                                                                                      TRUE
                                                                                      default
       parents  value
        <list> <list>
 1:                  
 2:                  
 3:                  
 4:                  
 5:                  
 6:                  
 7:                  
 8:                  
 9:                  
10:                  
11:                  
12:                  
13:                  
14:  splitrule       
15:                 1
16:                  
17:                  
18:                  
19:                  
20:                  
21:                  
22:                  
23:                  
24: importance       
25:                  
26:                  
27:                  
28:                  
29:                  
30:                  
       parents  value
代码
# 设置超参数调参
# lrn_ranger$param_set$set_values(
#   max.depth = to_tune(1, 10),
#   min.node.size = to_tune(1, 50),
#   min.bucket = to_tune(1, 10)
# )

# mlr3tuningspace中收集了常用的搜索空间,对于决策树、随机森林、xgboost这种著名模型,只需要用lts()方法,不需要手动设置值
# lrn_ranger = lts(lrn_ranger)

图学习器

代码
# 查看支持的图数据处理
po()
<DictionaryPipeOp> with 64 stored values
Keys: boxcox, branch, chunk, classbalancing, classifavg, classweights,
  colapply, collapsefactors, colroles, copy, datefeatures, encode,
  encodeimpact, encodelmer, featureunion, filter, fixfactors, histbin,
  ica, imputeconstant, imputehist, imputelearner, imputemean,
  imputemedian, imputemode, imputeoor, imputesample, kernelpca,
  learner, learner_cv, missind, modelmatrix, multiplicityexply,
  multiplicityimply, mutate, nmf, nop, ovrsplit, ovrunite, pca, proxy,
  quantilebin, randomprojection, randomresponse, regravg,
  removeconstants, renamecolumns, replicate, scale, scalemaxabs,
  scalerange, select, smote, spatialsign, subsample, targetinvert,
  targetmutate, targettrafoscalerange, textvectorizer, threshold,
  tunethreshold, unbranch, vtreat, yeojohnson
代码
preproc <- po("imputemedian") %>>%
  # po("collapsefactors", no_collapse_above_prevalence = 0.03) %>>%
  po("fixfactors") %>>%
  po("encode", method = "one-hot") %>>%
  po("scale")
graph <- preproc %>>% lrn_ranger # 接上学习器
graph$plot(html = TRUE, horizontal = TRUE) # 可视化
代码
glrn <- as_learner(graph) # 转化为图学习器

拟合数据

代码
## 拟合训练数据
glrn$train(task = tsk_penguins, row_ids = splits$train)

glrn$model
$imputemedian
$imputemedian$affected_cols
[1] "RowId"             "bill_depth_mm"     "bill_length_mm"   
[4] "body_mass_g"       "flipper_length_mm"

$imputemedian$intasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character

$imputemedian$model
$imputemedian$model$RowId
[1] 172

$imputemedian$model$bill_depth_mm
[1] 17.4

$imputemedian$model$bill_length_mm
[1] 44.4

$imputemedian$model$body_mass_g
[1] 4075

$imputemedian$model$flipper_length_mm
[1] 197


$imputemedian$outtasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character


$fixfactors
$fixfactors$levels
named list()

$fixfactors$affected_cols
[1] "RowId"             "island"            "sex"              
[4] "bill_depth_mm"     "bill_length_mm"    "body_mass_g"      
[7] "flipper_length_mm"

$fixfactors$intasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character

$fixfactors$outtasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character

$fixfactors$outtaskshell
Empty data.table (0 rows and 8 cols): species,RowId,island,sex,bill_depth_mm,bill_length_mm...


$encode
$encode$dt_columns
character(0)

$encode$affected_cols
[1] "RowId"             "island"            "sex"              
[4] "bill_depth_mm"     "bill_length_mm"    "body_mass_g"      
[7] "flipper_length_mm"

$encode$intasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character

$encode$outtasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character

$encode$outtaskshell
Empty data.table (0 rows and 8 cols): species,RowId,island,sex,bill_depth_mm,bill_length_mm...


$scale
$scale$center
            RowId     bill_depth_mm    bill_length_mm       body_mass_g 
        171.61628          17.20349          44.11938        4236.82171 
flipper_length_mm 
        201.16667 

$scale$scale
            RowId     bill_depth_mm    bill_length_mm       body_mass_g 
        98.481052          1.978058          5.408922        803.316191 
flipper_length_mm 
        14.170973 

$scale$dt_columns
[1] "RowId"             "bill_depth_mm"     "bill_length_mm"   
[4] "body_mass_g"       "flipper_length_mm"

$scale$affected_cols
[1] "RowId"             "island"            "sex"              
[4] "bill_depth_mm"     "bill_length_mm"    "body_mass_g"      
[7] "flipper_length_mm"

$scale$intasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   integer
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   integer
5: flipper_length_mm   integer
6:            island character
7:               sex character

$scale$outtasklayout
Key: <id>
                  id      type
              <char>    <char>
1:             RowId   numeric
2:     bill_depth_mm   numeric
3:    bill_length_mm   numeric
4:       body_mass_g   numeric
5: flipper_length_mm   numeric
6:            island character
7:               sex character

$scale$outtaskshell
Empty data.table (0 rows and 8 cols): species,island,sex,RowId,bill_depth_mm,bill_length_mm...


$classif.ranger
$classif.ranger$model
Ranger result

Call:
 ranger::ranger(dependent.variable.name = task$target_names, data = task$data(),      probability = self$predict_type == "prob", case.weights = task$weights$weight,      num.threads = 1L) 

Type:                             Classification 
Number of trees:                  500 
Sample size:                      258 
Number of independent variables:  7 
Mtry:                             2 
Target node size:                 1 
Variable importance mode:         none 
Splitrule:                        gini 
OOB prediction error:             0.00 % 

$classif.ranger$log
Empty data.table (0 rows and 3 cols): stage,class,msg

$classif.ranger$train_time
[1] 0.04

$classif.ranger$param_vals
$classif.ranger$param_vals$num.threads
[1] 1


$classif.ranger$task_hash
[1] "ea2f1f23e9fa461c"

$classif.ranger$feature_names
[1] "island"            "sex"               "RowId"            
[4] "bill_depth_mm"     "bill_length_mm"    "body_mass_g"      
[7] "flipper_length_mm"

$classif.ranger$mlr3_version
[1] '0.18.0'

$classif.ranger$data_prototype
Empty data.table (0 rows and 8 cols): species,island,sex,RowId,bill_depth_mm,bill_length_mm...

$classif.ranger$task_prototype
Empty data.table (0 rows and 8 cols): species,island,sex,RowId,bill_depth_mm,bill_length_mm...

$classif.ranger$train_task
<TaskClassif:penguins> (258 x 8)
* Target: species
* Properties: multiclass
* Features (7):
  - dbl (5): RowId, bill_depth_mm, bill_length_mm, body_mass_g,
    flipper_length_mm
  - chr (2): island, sex
代码
## 交叉验证拟合

# rr = resample(tsk_penguins, glrn, resampling)


## 超参数调参

at <- auto_tuner(
  tuner = tnr("random_search"),
  learner = preproc %>>% lrn("classif.ranger", max.depth = to_tune(1, 10)) %>% as_learner(),
  resampling = resampling,
  measure = msr("classif.ce"),
  term_evals = 4
)

at$train(tsk_penguins)
INFO  [11:57:02.183] [bbotk] Starting to optimize 1 parameter(s) with '<OptimizerRandomSearch>' and '<TerminatorEvals> [n_evals=4, k=0]'
INFO  [11:57:02.203] [bbotk] Evaluating 1 configuration(s)
INFO  [11:57:02.217] [mlr3] Running benchmark with 100 resampling iterations
INFO  [11:57:02.238] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 1/100)
INFO  [11:57:02.462] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 2/100)
INFO  [11:57:03.055] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 3/100)
INFO  [11:57:03.243] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 4/100)
INFO  [11:57:03.432] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 5/100)
INFO  [11:57:03.965] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 6/100)
INFO  [11:57:04.187] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 7/100)
INFO  [11:57:04.406] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 8/100)
INFO  [11:57:04.590] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 9/100)
INFO  [11:57:04.759] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 10/100)
INFO  [11:57:04.932] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 11/100)
INFO  [11:57:05.135] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 12/100)
INFO  [11:57:05.332] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 13/100)
INFO  [11:57:05.530] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 14/100)
INFO  [11:57:05.724] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 15/100)
INFO  [11:57:05.947] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 16/100)
INFO  [11:57:06.116] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 17/100)
INFO  [11:57:06.290] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 18/100)
INFO  [11:57:06.463] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 19/100)
INFO  [11:57:06.660] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 20/100)
INFO  [11:57:06.849] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 21/100)
INFO  [11:57:07.031] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 22/100)
INFO  [11:57:07.224] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 23/100)
INFO  [11:57:07.414] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 24/100)
INFO  [11:57:07.604] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 25/100)
INFO  [11:57:07.790] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 26/100)
INFO  [11:57:07.988] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 27/100)
INFO  [11:57:08.167] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 28/100)
INFO  [11:57:08.335] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 29/100)
INFO  [11:57:08.515] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 30/100)
INFO  [11:57:08.682] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 31/100)
INFO  [11:57:08.896] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 32/100)
INFO  [11:57:09.084] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 33/100)
INFO  [11:57:09.299] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 34/100)
INFO  [11:57:09.503] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 35/100)
INFO  [11:57:09.706] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 36/100)
INFO  [11:57:09.887] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 37/100)
INFO  [11:57:10.065] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 38/100)
INFO  [11:57:10.241] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 39/100)
INFO  [11:57:10.420] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 40/100)
INFO  [11:57:10.589] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 41/100)
INFO  [11:57:10.823] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 42/100)
INFO  [11:57:10.996] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 43/100)
INFO  [11:57:11.177] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 44/100)
INFO  [11:57:11.343] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 45/100)
INFO  [11:57:11.525] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 46/100)
INFO  [11:57:11.720] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 47/100)
INFO  [11:57:11.914] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 48/100)
INFO  [11:57:12.105] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 49/100)
INFO  [11:57:12.269] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 50/100)
INFO  [11:57:12.452] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 51/100)
INFO  [11:57:12.624] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 52/100)
INFO  [11:57:12.831] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 53/100)
INFO  [11:57:13.031] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 54/100)
INFO  [11:57:13.237] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 55/100)
INFO  [11:57:13.404] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 56/100)
INFO  [11:57:13.584] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 57/100)
INFO  [11:57:13.774] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 58/100)
INFO  [11:57:13.984] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 59/100)
INFO  [11:57:14.192] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 60/100)
INFO  [11:57:14.381] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 61/100)
INFO  [11:57:14.572] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 62/100)
INFO  [11:57:14.741] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 63/100)
INFO  [11:57:14.951] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 64/100)
INFO  [11:57:15.125] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 65/100)
INFO  [11:57:15.332] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 66/100)
INFO  [11:57:15.522] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 67/100)
INFO  [11:57:15.688] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 68/100)
INFO  [11:57:15.876] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 69/100)
INFO  [11:57:16.067] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 70/100)
INFO  [11:57:16.275] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 71/100)
INFO  [11:57:16.491] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 72/100)
INFO  [11:57:16.701] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 73/100)
INFO  [11:57:16.896] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 74/100)
INFO  [11:57:17.072] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 75/100)
INFO  [11:57:17.258] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 76/100)
INFO  [11:57:17.464] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 77/100)
INFO  [11:57:17.634] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 78/100)
INFO  [11:57:17.866] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 79/100)
INFO  [11:57:18.049] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 80/100)
INFO  [11:57:18.275] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 81/100)
INFO  [11:57:18.444] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 82/100)
INFO  [11:57:18.655] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 83/100)
INFO  [11:57:18.849] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 84/100)
INFO  [11:57:19.026] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 85/100)
INFO  [11:57:19.221] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 86/100)
INFO  [11:57:19.393] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 87/100)
INFO  [11:57:19.605] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 88/100)
INFO  [11:57:19.784] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 89/100)
INFO  [11:57:20.007] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 90/100)
INFO  [11:57:20.200] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 91/100)
INFO  [11:57:20.421] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 92/100)
INFO  [11:57:20.591] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 93/100)
INFO  [11:57:20.807] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 94/100)
INFO  [11:57:21.007] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 95/100)
INFO  [11:57:21.179] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 96/100)
INFO  [11:57:21.373] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 97/100)
INFO  [11:57:21.557] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 98/100)
INFO  [11:57:21.776] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 99/100)
INFO  [11:57:21.989] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 100/100)
INFO  [11:57:22.208] [mlr3] Finished benchmark
INFO  [11:57:22.286] [bbotk] Result of batch 1:
INFO  [11:57:22.287] [bbotk]  classif.ranger.max.depth  classif.ce warnings errors runtime_learners
INFO  [11:57:22.287] [bbotk]                         3 0.002016807        0      0            18.46
INFO  [11:57:22.287] [bbotk]                                 uhash
INFO  [11:57:22.287] [bbotk]  63ca9320-6594-47a6-85e5-0b689489c343
INFO  [11:57:22.289] [bbotk] Evaluating 1 configuration(s)
INFO  [11:57:22.297] [mlr3] Running benchmark with 100 resampling iterations
INFO  [11:57:22.302] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 1/100)
INFO  [11:57:22.521] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 2/100)
INFO  [11:57:22.699] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 3/100)
INFO  [11:57:22.905] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 4/100)
INFO  [11:57:23.133] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 5/100)
INFO  [11:57:23.350] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 6/100)
INFO  [11:57:23.574] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 7/100)
INFO  [11:57:23.769] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 8/100)
INFO  [11:57:23.949] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 9/100)
INFO  [11:57:24.154] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 10/100)
INFO  [11:57:24.347] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 11/100)
INFO  [11:57:24.543] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 12/100)
INFO  [11:57:24.742] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 13/100)
INFO  [11:57:24.923] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 14/100)
INFO  [11:57:25.181] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 15/100)
INFO  [11:57:25.370] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 16/100)
INFO  [11:57:25.571] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 17/100)
INFO  [11:57:25.770] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 18/100)
INFO  [11:57:26.003] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 19/100)
INFO  [11:57:26.249] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 20/100)
INFO  [11:57:26.430] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 21/100)
INFO  [11:57:26.634] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 22/100)
INFO  [11:57:26.809] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 23/100)
INFO  [11:57:27.010] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 24/100)
INFO  [11:57:27.195] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 25/100)
INFO  [11:57:27.411] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 26/100)
INFO  [11:57:27.620] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 27/100)
INFO  [11:57:27.798] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 28/100)
INFO  [11:57:28.008] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 29/100)
INFO  [11:57:28.184] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 30/100)
INFO  [11:57:28.388] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 31/100)
INFO  [11:57:28.612] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 32/100)
INFO  [11:57:28.827] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 33/100)
INFO  [11:57:29.077] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 34/100)
INFO  [11:57:29.271] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 35/100)
INFO  [11:57:29.485] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 36/100)
INFO  [11:57:29.700] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 37/100)
INFO  [11:57:29.912] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 38/100)
INFO  [11:57:30.128] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 39/100)
INFO  [11:57:30.302] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 40/100)
INFO  [11:57:30.508] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 41/100)
INFO  [11:57:30.720] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 42/100)
INFO  [11:57:30.970] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 43/100)
INFO  [11:57:31.226] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 44/100)
INFO  [11:57:31.407] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 45/100)
INFO  [11:57:31.611] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 46/100)
INFO  [11:57:31.837] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 47/100)
INFO  [11:57:32.063] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 48/100)
INFO  [11:57:32.280] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 49/100)
INFO  [11:57:32.549] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 50/100)
INFO  [11:57:32.748] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 51/100)
INFO  [11:57:32.966] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 52/100)
INFO  [11:57:33.167] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 53/100)
INFO  [11:57:33.401] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 54/100)
INFO  [11:57:33.596] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 55/100)
INFO  [11:57:33.805] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 56/100)
INFO  [11:57:33.995] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 57/100)
INFO  [11:57:34.228] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 58/100)
INFO  [11:57:34.453] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 59/100)
INFO  [11:57:34.663] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 60/100)
INFO  [11:57:34.875] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 61/100)
INFO  [11:57:35.053] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 62/100)
INFO  [11:57:35.278] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 63/100)
INFO  [11:57:35.509] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 64/100)
INFO  [11:57:35.737] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 65/100)
INFO  [11:57:35.986] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 66/100)
INFO  [11:57:36.170] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 67/100)
INFO  [11:57:36.408] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 68/100)
INFO  [11:57:36.607] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 69/100)
INFO  [11:57:36.816] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 70/100)
INFO  [11:57:37.016] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 71/100)
INFO  [11:57:37.222] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 72/100)
INFO  [11:57:37.481] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 73/100)
INFO  [11:57:37.701] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 74/100)
INFO  [11:57:37.926] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 75/100)
INFO  [11:57:38.138] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 76/100)
INFO  [11:57:38.334] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 77/100)
INFO  [11:57:38.555] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 78/100)
INFO  [11:57:38.759] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 79/100)
INFO  [11:57:38.944] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 80/100)
INFO  [11:57:39.185] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 81/100)
INFO  [11:57:39.402] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 82/100)
INFO  [11:57:39.642] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 83/100)
INFO  [11:57:39.860] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 84/100)
INFO  [11:57:40.108] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 85/100)
INFO  [11:57:40.302] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 86/100)
INFO  [11:57:40.512] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 87/100)
INFO  [11:57:40.743] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 88/100)
INFO  [11:57:40.984] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 89/100)
INFO  [11:57:41.188] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 90/100)
INFO  [11:57:41.412] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 91/100)
INFO  [11:57:41.588] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 92/100)
INFO  [11:57:41.807] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 93/100)
INFO  [11:57:42.055] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 94/100)
INFO  [11:57:42.271] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 95/100)
INFO  [11:57:42.514] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 96/100)
INFO  [11:57:42.706] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 97/100)
INFO  [11:57:42.940] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 98/100)
INFO  [11:57:43.147] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 99/100)
INFO  [11:57:43.346] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 100/100)
INFO  [11:57:43.576] [mlr3] Finished benchmark
INFO  [11:57:43.643] [bbotk] Result of batch 2:
INFO  [11:57:43.645] [bbotk]  classif.ranger.max.depth   classif.ce warnings errors runtime_learners
INFO  [11:57:43.645] [bbotk]                         6 0.0005714286        0      0            19.58
INFO  [11:57:43.645] [bbotk]                                 uhash
INFO  [11:57:43.645] [bbotk]  b5350864-43ac-4082-90dd-1727a29fde2e
INFO  [11:57:43.646] [bbotk] Evaluating 1 configuration(s)
INFO  [11:57:43.653] [mlr3] Running benchmark with 100 resampling iterations
INFO  [11:57:43.659] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 1/100)
INFO  [11:57:43.862] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 2/100)
INFO  [11:57:44.061] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 3/100)
INFO  [11:57:44.266] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 4/100)
INFO  [11:57:44.441] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 5/100)
INFO  [11:57:44.670] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 6/100)
INFO  [11:57:44.864] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 7/100)
INFO  [11:57:45.054] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 8/100)
INFO  [11:57:45.263] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 9/100)
INFO  [11:57:45.437] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 10/100)
INFO  [11:57:45.656] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 11/100)
INFO  [11:57:45.866] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 12/100)
INFO  [11:57:46.064] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 13/100)
INFO  [11:57:46.283] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 14/100)
INFO  [11:57:46.477] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 15/100)
INFO  [11:57:46.697] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 16/100)
INFO  [11:57:46.913] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 17/100)
INFO  [11:57:47.109] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 18/100)
INFO  [11:57:47.310] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 19/100)
INFO  [11:57:47.866] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 20/100)
INFO  [11:57:48.025] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 21/100)
INFO  [11:57:48.199] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 22/100)
INFO  [11:57:48.361] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 23/100)
INFO  [11:57:48.525] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 24/100)
INFO  [11:57:48.701] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 25/100)
INFO  [11:57:48.891] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 26/100)
INFO  [11:57:49.092] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 27/100)
INFO  [11:57:49.259] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 28/100)
INFO  [11:57:49.425] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 29/100)
INFO  [11:57:49.597] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 30/100)
INFO  [11:57:49.770] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 31/100)
INFO  [11:57:49.965] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 32/100)
INFO  [11:57:50.131] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 33/100)
INFO  [11:57:50.319] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 34/100)
INFO  [11:57:50.482] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 35/100)
INFO  [11:57:50.653] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 36/100)
INFO  [11:57:50.823] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 37/100)
INFO  [11:57:50.988] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 38/100)
INFO  [11:57:51.176] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 39/100)
INFO  [11:57:51.344] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 40/100)
INFO  [11:57:51.516] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 41/100)
INFO  [11:57:51.687] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 42/100)
INFO  [11:57:51.861] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 43/100)
INFO  [11:57:52.035] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 44/100)
INFO  [11:57:52.221] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 45/100)
INFO  [11:57:52.442] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 46/100)
INFO  [11:57:52.645] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 47/100)
INFO  [11:57:52.874] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 48/100)
INFO  [11:57:53.044] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 49/100)
INFO  [11:57:53.218] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 50/100)
INFO  [11:57:53.390] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 51/100)
INFO  [11:57:53.552] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 52/100)
INFO  [11:57:53.754] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 53/100)
INFO  [11:57:53.937] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 54/100)
INFO  [11:57:54.143] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 55/100)
INFO  [11:57:54.334] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 56/100)
INFO  [11:57:54.510] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 57/100)
INFO  [11:57:54.695] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 58/100)
INFO  [11:57:54.865] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 59/100)
INFO  [11:57:55.042] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 60/100)
INFO  [11:57:55.206] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 61/100)
INFO  [11:57:55.388] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 62/100)
INFO  [11:57:55.550] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 63/100)
INFO  [11:57:55.746] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 64/100)
INFO  [11:57:55.927] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 65/100)
INFO  [11:57:56.140] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 66/100)
INFO  [11:57:56.335] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 67/100)
INFO  [11:57:56.525] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 68/100)
INFO  [11:57:56.779] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 69/100)
INFO  [11:57:56.946] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 70/100)
INFO  [11:57:57.129] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 71/100)
INFO  [11:57:57.295] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 72/100)
INFO  [11:57:57.503] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 73/100)
INFO  [11:57:57.711] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 74/100)
INFO  [11:57:57.899] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 75/100)
INFO  [11:57:58.098] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 76/100)
INFO  [11:57:58.281] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 77/100)
INFO  [11:57:58.460] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 78/100)
INFO  [11:57:58.637] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 79/100)
INFO  [11:57:58.826] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 80/100)
INFO  [11:57:59.041] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 81/100)
INFO  [11:57:59.235] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 82/100)
INFO  [11:57:59.463] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 83/100)
INFO  [11:57:59.704] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 84/100)
INFO  [11:57:59.889] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 85/100)
INFO  [11:58:00.076] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 86/100)
INFO  [11:58:00.240] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 87/100)
INFO  [11:58:00.441] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 88/100)
INFO  [11:58:00.605] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 89/100)
INFO  [11:58:00.782] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 90/100)
INFO  [11:58:00.947] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 91/100)
INFO  [11:58:01.112] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 92/100)
INFO  [11:58:01.304] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 93/100)
INFO  [11:58:01.490] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 94/100)
INFO  [11:58:01.674] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 95/100)
INFO  [11:58:01.839] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 96/100)
INFO  [11:58:02.023] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 97/100)
INFO  [11:58:02.209] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 98/100)
INFO  [11:58:02.393] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 99/100)
INFO  [11:58:02.586] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 100/100)
INFO  [11:58:02.793] [mlr3] Finished benchmark
INFO  [11:58:02.885] [bbotk] Result of batch 3:
INFO  [11:58:02.887] [bbotk]  classif.ranger.max.depth classif.ce warnings errors runtime_learners
INFO  [11:58:02.887] [bbotk]                         2 0.01163025        0      0            17.78
INFO  [11:58:02.887] [bbotk]                                 uhash
INFO  [11:58:02.887] [bbotk]  4c0fe802-01ad-43cc-b69e-1da967c60b66
INFO  [11:58:02.889] [bbotk] Evaluating 1 configuration(s)
INFO  [11:58:02.896] [mlr3] Running benchmark with 100 resampling iterations
INFO  [11:58:02.902] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 1/100)
INFO  [11:58:03.118] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 2/100)
INFO  [11:58:03.311] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 3/100)
INFO  [11:58:03.485] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 4/100)
INFO  [11:58:03.684] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 5/100)
INFO  [11:58:03.881] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 6/100)
INFO  [11:58:04.083] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 7/100)
INFO  [11:58:04.259] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 8/100)
INFO  [11:58:04.440] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 9/100)
INFO  [11:58:04.643] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 10/100)
INFO  [11:58:04.818] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 11/100)
INFO  [11:58:05.014] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 12/100)
INFO  [11:58:05.191] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 13/100)
INFO  [11:58:05.390] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 14/100)
INFO  [11:58:05.561] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 15/100)
INFO  [11:58:05.847] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 16/100)
INFO  [11:58:06.086] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 17/100)
INFO  [11:58:06.287] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 18/100)
INFO  [11:58:06.519] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 19/100)
INFO  [11:58:06.709] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 20/100)
INFO  [11:58:06.907] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 21/100)
INFO  [11:58:07.086] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 22/100)
INFO  [11:58:07.275] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 23/100)
INFO  [11:58:07.464] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 24/100)
INFO  [11:58:07.635] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 25/100)
INFO  [11:58:07.853] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 26/100)
INFO  [11:58:08.043] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 27/100)
INFO  [11:58:08.265] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 28/100)
INFO  [11:58:08.451] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 29/100)
INFO  [11:58:08.633] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 30/100)
INFO  [11:58:08.827] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 31/100)
INFO  [11:58:09.029] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 32/100)
INFO  [11:58:09.232] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 33/100)
INFO  [11:58:09.425] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 34/100)
INFO  [11:58:09.643] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 35/100)
INFO  [11:58:09.831] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 36/100)
INFO  [11:58:10.031] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 37/100)
INFO  [11:58:10.216] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 38/100)
INFO  [11:58:10.394] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 39/100)
INFO  [11:58:10.594] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 40/100)
INFO  [11:58:10.766] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 41/100)
INFO  [11:58:10.963] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 42/100)
INFO  [11:58:11.134] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 43/100)
INFO  [11:58:11.330] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 44/100)
INFO  [11:58:11.532] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 45/100)
INFO  [11:58:11.724] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 46/100)
INFO  [11:58:11.966] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 47/100)
INFO  [11:58:12.159] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 48/100)
INFO  [11:58:12.360] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 49/100)
INFO  [11:58:12.529] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 50/100)
INFO  [11:58:12.738] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 51/100)
INFO  [11:58:12.912] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 52/100)
INFO  [11:58:13.118] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 53/100)
INFO  [11:58:13.294] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 54/100)
INFO  [11:58:13.483] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 55/100)
INFO  [11:58:13.665] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 56/100)
INFO  [11:58:13.845] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 57/100)
INFO  [11:58:14.059] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 58/100)
INFO  [11:58:14.271] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 59/100)
INFO  [11:58:14.486] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 60/100)
INFO  [11:58:14.664] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 61/100)
INFO  [11:58:14.869] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 62/100)
INFO  [11:58:15.043] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 63/100)
INFO  [11:58:15.319] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 64/100)
INFO  [11:58:15.502] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 65/100)
INFO  [11:58:15.711] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 66/100)
INFO  [11:58:15.904] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 67/100)
INFO  [11:58:16.074] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 68/100)
INFO  [11:58:16.284] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 69/100)
INFO  [11:58:16.465] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 70/100)
INFO  [11:58:16.665] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 71/100)
INFO  [11:58:16.851] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 72/100)
INFO  [11:58:17.042] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 73/100)
INFO  [11:58:17.245] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 74/100)
INFO  [11:58:17.425] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 75/100)
INFO  [11:58:17.633] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 76/100)
INFO  [11:58:17.836] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 77/100)
INFO  [11:58:18.037] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 78/100)
INFO  [11:58:18.216] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 79/100)
INFO  [11:58:18.385] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 80/100)
INFO  [11:58:18.598] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 81/100)
INFO  [11:58:18.772] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 82/100)
INFO  [11:58:18.999] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 83/100)
INFO  [11:58:19.184] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 84/100)
INFO  [11:58:19.390] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 85/100)
INFO  [11:58:19.578] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 86/100)
INFO  [11:58:19.773] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 87/100)
INFO  [11:58:19.988] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 88/100)
INFO  [11:58:20.161] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 89/100)
INFO  [11:58:20.366] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 90/100)
INFO  [11:58:20.540] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 91/100)
INFO  [11:58:20.738] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 92/100)
INFO  [11:58:20.915] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 93/100)
INFO  [11:58:21.130] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 94/100)
INFO  [11:58:21.306] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 95/100)
INFO  [11:58:21.494] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 96/100)
INFO  [11:58:21.679] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 97/100)
INFO  [11:58:21.878] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 98/100)
INFO  [11:58:22.071] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 99/100)
INFO  [11:58:22.244] [mlr3] Applying learner 'imputemedian.fixfactors.encode.scale.classif.ranger' on task 'penguins' (iter 100/100)
INFO  [11:58:22.464] [mlr3] Finished benchmark
INFO  [11:58:22.528] [bbotk] Result of batch 4:
INFO  [11:58:22.529] [bbotk]  classif.ranger.max.depth   classif.ce warnings errors runtime_learners
INFO  [11:58:22.529] [bbotk]                         6 0.0002857143        0      0            17.96
INFO  [11:58:22.529] [bbotk]                                 uhash
INFO  [11:58:22.529] [bbotk]  50148915-f4ec-4883-a943-32b7f6ff69df
INFO  [11:58:22.534] [bbotk] Finished optimizing after 4 evaluation(s)
INFO  [11:58:22.534] [bbotk] Result:
INFO  [11:58:22.535] [bbotk]  classif.ranger.max.depth learner_param_vals  x_domain   classif.ce
INFO  [11:58:22.535] [bbotk]                     <int>             <list>    <list>        <num>
INFO  [11:58:22.535] [bbotk]                         6          <list[5]> <list[1]> 0.0002857143

预测新数据

代码
penguins_pred_mlr3 <- glrn$predict(task = tsk_penguins, row_ids = splits$test)

penguins_pred_mlr3_at <- at$predict(task = tsk_penguins, row_ids = splits$test)

模型评价

代码
# 混淆矩阵
penguins_pred_mlr3$confusion
           truth
response    Adelie Chinstrap Gentoo
  Adelie        38         0      0
  Chinstrap      0        17      0
  Gentoo         0         0     31
代码
penguins_pred_mlr3_at$confusion
           truth
response    Adelie Chinstrap Gentoo
  Adelie        38         0      0
  Chinstrap      0        17      0
  Gentoo         0         0     31
代码
# 查看评估指标
msrs()
<DictionaryMeasure> with 66 stored values
Keys: aic, bic, classif.acc, classif.auc, classif.bacc, classif.bbrier,
  classif.ce, classif.costs, classif.dor, classif.fbeta, classif.fdr,
  classif.fn, classif.fnr, classif.fomr, classif.fp, classif.fpr,
  classif.logloss, classif.mauc_au1p, classif.mauc_au1u,
  classif.mauc_aunp, classif.mauc_aunu, classif.mbrier, classif.mcc,
  classif.npv, classif.ppv, classif.prauc, classif.precision,
  classif.recall, classif.sensitivity, classif.specificity, classif.tn,
  classif.tnr, classif.tp, classif.tpr, clust.ch, clust.dunn,
  clust.silhouette, clust.wss, debug_classif, oob_error, regr.bias,
  regr.ktau, regr.mae, regr.mape, regr.maxae, regr.medae, regr.medse,
  regr.mse, regr.msle, regr.pbias, regr.rae, regr.rmse, regr.rmsle,
  regr.rrse, regr.rse, regr.rsq, regr.sae, regr.smape, regr.srho,
  regr.sse, selected_features, sim.jaccard, sim.phi, time_both,
  time_predict, time_train
代码
measure <- msrs(c("classif.acc", "classif.ce"))

penguins_pred_mlr3$score(measure)
classif.acc  classif.ce 
          1           0 
代码
# 交叉验证评估
# rr$score(measure)[, .(task_id, learner_id, iteration, classif.acc)]

观察数据

代码
import pandas as pd
from sklearn.model_selection import train_test_split, StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder
from sklearn.impute import SimpleImputer
from sklearn.feature_selection import VarianceThreshold
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import roc_curve, roc_auc_score, accuracy_score


print(df_penguins.head())
  species     island  bill_length_mm  ...  flipper_length_mm  body_mass_g     sex
0  Adelie  Torgersen            39.1  ...              181.0       3750.0    MALE
1  Adelie  Torgersen            39.5  ...              186.0       3800.0  FEMALE
2  Adelie  Torgersen            40.3  ...              195.0       3250.0  FEMALE
3  Adelie  Torgersen             NaN  ...                NaN          NaN     NaN
4  Adelie  Torgersen            36.7  ...              193.0       3450.0  FEMALE

[5 rows x 7 columns]
代码
print(df_penguins.describe())
       bill_length_mm  bill_depth_mm  flipper_length_mm  body_mass_g
count      342.000000     342.000000         342.000000   342.000000
mean        43.921930      17.151170         200.915205  4201.754386
std          5.459584       1.974793          14.061714   801.954536
min         32.100000      13.100000         172.000000  2700.000000
25%         39.225000      15.600000         190.000000  3550.000000
50%         44.450000      17.300000         197.000000  4050.000000
75%         48.500000      18.700000         213.000000  4750.000000
max         59.600000      21.500000         231.000000  6300.000000

数据拆分

代码

df_penguins['species'] = pd.Categorical(df_penguins['species'])
X = df_penguins.drop(['species'], axis=1)
y = df_penguins['species']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=123, stratify=y)

# 交叉验证
skf = StratifiedKFold(n_splits=10, shuffle=True, random_state=123)

创建配方

代码
numeric_features = X.select_dtypes(include=['int', 'float']).columns
categorical_features = X.select_dtypes(include=['object', 'category']).columns

preprocessor = ColumnTransformer([
    ('onehot', OneHotEncoder(), categorical_features),
    ('imputer', SimpleImputer(), numeric_features),
    ('variance_threshold', VarianceThreshold(), numeric_features)
])

创建模型

代码
rf = RandomForestClassifier(n_estimators=1000)
param_grid = {
    'max_depth': [None, 5, 10, 15, 20],
    'min_samples_split': [2, 5, 10]
}
grid_search = GridSearchCV(rf, param_grid, cv=skf)

创建工作流

代码
pipeline = Pipeline([
    ('preprocessor', preprocessor),
    ('model', rf)
])

拟合数据

代码
pipeline.fit(X_train, y_train)
Pipeline(steps=[('preprocessor',
                 ColumnTransformer(transformers=[('onehot', OneHotEncoder(),
                                                  Index(['island', 'sex'], dtype='object')),
                                                 ('imputer', SimpleImputer(),
                                                  Index(['bill_length_mm', 'bill_depth_mm', 'flipper_length_mm', 'body_mass_g'], dtype='object')),
                                                 ('variance_threshold',
                                                  VarianceThreshold(),
                                                  Index(['bill_length_mm', 'bill_depth_mm', 'flipper_length_mm', 'body_mass_g'], dtype='object'))])),
                ('model', RandomForestClassifier(n_estimators=1000))])
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.

预测新数据

代码
y_pred = pipeline.predict(X_test)

模型评价

代码
y_pred_proba = pipeline.predict_proba(X_test)
# fpr, tpr, _ = roc_curve(y_test, y_pred_proba[:, 1])
# roc_auc = roc_auc_score(y_test, y_pred_proba[:, 1])
accuracy = accuracy_score(y_test, y_pred)

print(accuracy)
0.9883720930232558
回到顶部