|
| 1 | +# xgboost execution, classification |
| 2 | + |
| 3 | + Code |
| 4 | + res <- parsnip::fit(hpc_xgboost, class ~ novar, data = hpc, control = ctrl) |
| 5 | + Condition |
| 6 | + Error: |
| 7 | + ! object 'novar' not found |
| 8 | + |
| 9 | +# submodel prediction |
| 10 | + |
| 11 | + Code |
| 12 | + multi_predict(class_fit, newdata = wa_churn[1:4, vars], trees = 5, type = "prob") |
| 13 | + Condition |
| 14 | + Error in `multi_predict()`: |
| 15 | + ! Please use `new_data` instead of `newdata`. |
| 16 | + |
| 17 | +# validation sets |
| 18 | + |
| 19 | + Code |
| 20 | + reg_fit <- fit(set_engine(boost_tree(trees = 20, mode = "regression"), |
| 21 | + "xgboost", validation = 3), mpg ~ ., data = mtcars[-(1:4), ]) |
| 22 | + Condition |
| 23 | + Error in `parsnip::xgb_train()`: |
| 24 | + ! `validation` should be on [0, 1). |
| 25 | + |
| 26 | +# early stopping |
| 27 | + |
| 28 | + Code |
| 29 | + reg_fit <- fit(set_engine(boost_tree(trees = 20, stop_iter = 30, mode = "regression"), |
| 30 | + "xgboost", validation = 0.1), mpg ~ ., data = mtcars[-(1:4), ]) |
| 31 | + Condition |
| 32 | + Warning: |
| 33 | + `early_stop` was reduced to 19. |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | + Code |
| 38 | + reg_fit <- fit(set_engine(boost_tree(trees = 20, stop_iter = 0, mode = "regression"), |
| 39 | + "xgboost", validation = 0.1), mpg ~ ., data = mtcars[-(1:4), ]) |
| 40 | + Condition |
| 41 | + Error in `parsnip::xgb_train()`: |
| 42 | + ! `early_stop` should be on [2, 20). |
| 43 | + |
| 44 | +# xgboost data conversion |
| 45 | + |
| 46 | + Code |
| 47 | + from_df <- parsnip:::as_xgb_data(mtcar_x, mtcars_y, event_level = "second") |
| 48 | + Condition |
| 49 | + Warning: |
| 50 | + `event_level` can only be set for binary outcomes. |
| 51 | + |
| 52 | +# argument checks for data dimensions |
| 53 | + |
| 54 | + Code |
| 55 | + f_fit <- fit(spec, species ~ ., data = penguins, control = ctrl) |
| 56 | + Condition |
| 57 | + Warning: |
| 58 | + ! 1000 samples were requested but there were 333 rows in the data. |
| 59 | + i 333 will be used. |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | + Code |
| 64 | + xy_fit <- fit_xy(spec, x = penguins_dummy, y = penguins$species, control = ctrl) |
| 65 | + Condition |
| 66 | + Warning: |
| 67 | + ! 1000 samples were requested but there were 333 rows in the data. |
| 68 | + i 333 will be used. |
| 69 | + |
| 70 | +# count/proportion parameters |
| 71 | + |
| 72 | + Code |
| 73 | + fit(set_mode(set_engine(boost_tree(mtry = 0.9, trees = 4), "xgboost"), |
| 74 | + "regression"), mpg ~ ., data = mtcars) |
| 75 | + Condition |
| 76 | + Error in `xgb_train()`: |
| 77 | + ! The option `counts = TRUE` was used but `colsample_bynode` was given as 0.9. |
| 78 | + i Please use a value >= 1 or use `counts = FALSE`. |
| 79 | + |
| 80 | +# interface to param arguments |
| 81 | + |
| 82 | + ! Please supply elements of the `params` list argument as main arguments to `set_engine()` rather than as part of `params`. |
| 83 | + i See `?details_boost_tree_xgboost` for more information. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | + ! Please supply elements of the `params` list argument as main arguments to `set_engine()` rather than as part of `params`. |
| 88 | + i See `?details_boost_tree_xgboost` for more information. |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | + ! The argument `watchlist` is guarded by parsnip and will not be passed to `xgb.train()`. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | + ! The arguments `watchlist` and `data` are guarded by parsnip and will not be passed to `xgb.train()`. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | + ! Please supply elements of the `params` list argument as main arguments to `set_engine()` rather than as part of `params`. |
| 101 | + i See `?details_boost_tree_xgboost` for more information. |
| 102 | + |
0 commit comments