@@ -9,7 +9,7 @@ hpc_xgboost <-
99 set_engine(" xgboost" )
1010
1111extract_xgb_param <- function (x , param ) {
12- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
12+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
1313 res <- attr(extract_fit_engine(x ), " params" )[[param ]]
1414 } else {
1515 res <- extract_fit_engine(x )$ param [[param ]]
@@ -18,7 +18,7 @@ extract_xgb_param <- function(x, param) {
1818}
1919
2020extract_xgb_evaluation_log <- function (x ) {
21- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
21+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
2222 res <- attr(extract_fit_engine(x ), " evaluation_log" )
2323 } else {
2424 res <- extract_fit_engine(x )[[" evaluation_log" ]]
@@ -408,15 +408,15 @@ test_that('early stopping', {
408408 )
409409
410410 extract_xgb_nitter <- function (x ) {
411- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
411+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
412412 res <- nrow(attr(extract_fit_engine(x ), " evaluation_log" ))
413413 } else {
414414 res <- extract_fit_engine(reg_fit )$ niter
415415 }
416416 res
417417 }
418418 extract_xgb_best_iteration <- function (x ) {
419- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
419+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
420420 res <- attr(extract_fit_engine(x ), " early_stop" )$ best_iteration
421421 } else {
422422 res <- extract_fit_engine(reg_fit )$ best_iteration
@@ -572,7 +572,7 @@ test_that('xgboost data and sparse matrices', {
572572 from_mat $ fit $ handle <- NULL
573573 from_sparse $ fit $ handle <- NULL
574574
575- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
575+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
576576 expect_equal(
577577 attributes(extract_fit_engine(from_df )),
578578 attributes(extract_fit_engine(from_mat )),
@@ -689,7 +689,7 @@ test_that("fit and prediction with `event_level`", {
689689 xgbmat_train_1 <- xgb.DMatrix(data = train_x , label = train_y_1 )
690690
691691 set.seed(24 )
692- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
692+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
693693 fit_xgb_1 <- xgboost :: xgb.train(
694694 params = list (
695695 objective = " binary:logistic" ,
@@ -729,7 +729,7 @@ test_that("fit and prediction with `event_level`", {
729729 xgbmat_train_2 <- xgb.DMatrix(data = train_x , label = train_y_2 )
730730
731731 set.seed(24 )
732- if (utils :: packageVersion(" xgboost" ) > " 2.0.0.0" ) {
732+ if (utils :: packageVersion(" xgboost" ) > = " 2.0.0.0" ) {
733733 fit_xgb_2 <- xgboost :: xgb.train(
734734 params = list (
735735 eval_metric = " auc" ,
0 commit comments