From 400c7f4d8e8bcc72ed4a0814a052f17124b9e7da Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Fri, 22 Sep 2023 04:05:11 +0000 Subject: [PATCH 1/2] build: bump `XGBoost` to 2 --- docs/Project.toml | 2 +- lib/SurrogatesMOE/Project.toml | 2 +- lib/SurrogatesRandomForest/Project.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 4093249c5..be97ce9de 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -25,5 +25,5 @@ SurrogatesMOE = "0.1.0" SurrogatesPolyChaos = "0.1.0" SurrogatesRandomForest = "0.1.0" SurrogatesSVM = "0.1.0" -XGBoost = "1.5" +XGBoost = "2" Zygote = "0.6.49" diff --git a/lib/SurrogatesMOE/Project.toml b/lib/SurrogatesMOE/Project.toml index 5ca0f5322..7d85bccbc 100644 --- a/lib/SurrogatesMOE/Project.toml +++ b/lib/SurrogatesMOE/Project.toml @@ -24,7 +24,7 @@ Surrogates = "6.0" SurrogatesFlux = "0.1.0" SurrogatesPolyChaos = "0.1.0" SurrogatesRandomForest = "0.1.0" -XGBoost = "1.5.2" +XGBoost = "2" [extras] Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" diff --git a/lib/SurrogatesRandomForest/Project.toml b/lib/SurrogatesRandomForest/Project.toml index c446d0137..9fecfdefc 100644 --- a/lib/SurrogatesRandomForest/Project.toml +++ b/lib/SurrogatesRandomForest/Project.toml @@ -9,7 +9,7 @@ XGBoost = "009559a3-9522-5dbb-924b-0b6ed2b22bb9" [compat] Surrogates = "6" -XGBoost = "1.5" +XGBoost = "2" julia = "1.6" [extras] From 50567c2291d00120cd0bc8a06e9357be0564972a Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Fri, 22 Sep 2023 04:05:35 +0000 Subject: [PATCH 2/2] refactor: `SurrogatesRandomForest` RandomForest code to use `XGBoost` 2 --- lib/SurrogatesRandomForest/src/SurrogatesRandomForest.jl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/SurrogatesRandomForest/src/SurrogatesRandomForest.jl b/lib/SurrogatesRandomForest/src/SurrogatesRandomForest.jl index fc77f0dda..69532f999 100644 --- a/lib/SurrogatesRandomForest/src/SurrogatesRandomForest.jl +++ b/lib/SurrogatesRandomForest/src/SurrogatesRandomForest.jl @@ -14,7 +14,7 @@ mutable struct RandomForestSurrogate{X, Y, B, L, U, N} <: AbstractSurrogate end function RandomForestSurrogate(x, y, lb::Number, ub::Number; num_round::Int = 1) - bst = xgboost(reshape(x, length(x), 1), num_round, label = y) + bst = xgboost((reshape(x, length(x), 1), y); num_round) RandomForestSurrogate(x, y, bst, lb, ub, num_round) end @@ -35,7 +35,7 @@ function RandomForestSurrogate(x, y, lb, ub; num_round::Int = 1) for j in 1:length(x) X[j, :] = vec(collect(x[j])) end - bst = xgboost(X, num_round, label = y) + bst = xgboost((X, y); num_round) RandomForestSurrogate(x, y, bst, lb, ub, num_round) end @@ -50,8 +50,7 @@ function add_point!(rndfor::RandomForestSurrogate, x_new, y_new) #1D rndfor.x = vcat(rndfor.x, x_new) rndfor.y = vcat(rndfor.y, y_new) - rndfor.bst = xgboost(reshape(rndfor.x, length(rndfor.x), 1), rndfor.num_round, - label = rndfor.y) + rndfor.bst = xgboost((reshape(rndfor.x, length(rndfor.x), 1), rndfor.y); num_round = rndfor.num_round) else n_previous = length(rndfor.x) a = vcat(rndfor.x, x_new) @@ -75,7 +74,7 @@ function add_point!(rndfor::RandomForestSurrogate, x_new, y_new) end rndfor.x = vcat(rndfor.x, x_new) rndfor.y = vcat(rndfor.y, y_new) - rndfor.bst = xgboost(X, rndfor.num_round, label = rndfor.y) + rndfor.bst = xgboost((X, rndfor.y); num_round = rndfor.num_round) end nothing end