Wraps the xgboost package. If xgboost isn't installed, falls
back to gbm (gradient boosting) so users still get a usable
boosted-trees result; the backend is flagged in the output.
Usage
morie_xgboost_objective(
x,
y,
n_estimators = 100L,
learning_rate = 0.1,
max_depth = 3L,
reg_lambda = 1,
reg_alpha = 0,
task = "auto",
seed = 0L,
deterministic_seed = NULL
)Arguments
- x
Numeric predictor matrix.
- y
Response.
- n_estimators
Number of boosting rounds.
- learning_rate
eta / shrinkage.
- max_depth
Tree depth.
- reg_lambda
L2 leaf penalty.
- reg_alpha
L1 leaf penalty.
- task
"auto", "classification", or "regression".
- seed
RNG seed.
- deterministic_seed
Integer or NULL. If supplied, the RNG state is derived from the SHA-keyed
morie_det_rng()so Py<->R streams agree on the canonical fixture. WhenNULL(default), behaviour is unchanged:seeddrivesset.seed()directly.
Value
Named list: estimate, train_score, feature_importances, backend, n_estimators, learning_rate, max_depth, reg_lambda, reg_alpha, task, n, method.
Examples
morie_xgboost_objective(x = rnorm(50), y = rnorm(50))
#> $estimate
#> [1] 0.8654083
#>
#> $train_score
#> [1] 0.8654083
#>
#> $feature_importances
#> [1] 0.4503273 0.5496727
#>
#> $backend
#> [1] "xgboost"
#>
#> $n_estimators
#> [1] 100
#>
#> $learning_rate
#> [1] 0.1
#>
#> $max_depth
#> [1] 3
#>
#> $reg_lambda
#> [1] 1
#>
#> $reg_alpha
#> [1] 0
#>
#> $task
#> [1] "regression"
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "XGBoost-style boosting (xgboost, regression)"
#>