Skip to content

Commit aba9812

Browse files
authored
[R] Removing failing tests in 1.7. (dmlc#11438)
1 parent 26fc892 commit aba9812

File tree

18 files changed

+25
-271
lines changed

18 files changed

+25
-271
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
2-
project(xgboost LANGUAGES CXX C VERSION 1.7.10)
2+
project(xgboost LANGUAGES CXX C VERSION 1.7.11)
33
include(cmake/Utils.cmake)
44
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
55
cmake_policy(SET CMP0022 NEW)

R-package/DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: xgboost
22
Type: Package
33
Title: Extreme Gradient Boosting
4-
Version: 1.7.10.1
5-
Date: 2025-04-22
4+
Version: 1.7.11.1
5+
Date: 2025-05-01
66
Authors@R: c(
77
person("Tianqi", "Chen", role = c("aut"),
88
email = "tianqi.tchen@gmail.com"),

R-package/configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for xgboost 1.7.10.
3+
# Generated by GNU Autoconf 2.71 for xgboost 1.7.11.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -607,8 +607,8 @@ MAKEFLAGS=
607607
# Identity of this package.
608608
PACKAGE_NAME='xgboost'
609609
PACKAGE_TARNAME='xgboost'
610-
PACKAGE_VERSION='1.7.10'
611-
PACKAGE_STRING='xgboost 1.7.10'
610+
PACKAGE_VERSION='1.7.11'
611+
PACKAGE_STRING='xgboost 1.7.11'
612612
PACKAGE_BUGREPORT=''
613613
PACKAGE_URL=''
614614

@@ -1226,7 +1226,7 @@ if test "$ac_init_help" = "long"; then
12261226
# Omit some internal or obsolete options to make the list less imposing.
12271227
# This message is too long to be a string in the A/UX 3.1 sh.
12281228
cat <<_ACEOF
1229-
\`configure' configures xgboost 1.7.10 to adapt to many kinds of systems.
1229+
\`configure' configures xgboost 1.7.11 to adapt to many kinds of systems.
12301230
12311231
Usage: $0 [OPTION]... [VAR=VALUE]...
12321232
@@ -1288,7 +1288,7 @@ fi
12881288

12891289
if test -n "$ac_init_help"; then
12901290
case $ac_init_help in
1291-
short | recursive ) echo "Configuration of xgboost 1.7.10:";;
1291+
short | recursive ) echo "Configuration of xgboost 1.7.11:";;
12921292
esac
12931293
cat <<\_ACEOF
12941294
@@ -1368,7 +1368,7 @@ fi
13681368
test -n "$ac_init_help" && exit $ac_status
13691369
if $ac_init_version; then
13701370
cat <<\_ACEOF
1371-
xgboost configure 1.7.10
1371+
xgboost configure 1.7.11
13721372
generated by GNU Autoconf 2.71
13731373
13741374
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1596,7 +1596,7 @@ cat >config.log <<_ACEOF
15961596
This file contains any messages produced by compilers while
15971597
running configure, to aid debugging if configure makes a mistake.
15981598
1599-
It was created by xgboost $as_me 1.7.10, which was
1599+
It was created by xgboost $as_me 1.7.11, which was
16001600
generated by GNU Autoconf 2.71. Invocation command line was
16011601
16021602
$ $0$ac_configure_args_raw
@@ -3498,7 +3498,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
34983498
# report actual input values of CONFIG_FILES etc. instead of their
34993499
# values after options handling.
35003500
ac_log="
3501-
This file was extended by xgboost $as_me 1.7.10, which was
3501+
This file was extended by xgboost $as_me 1.7.11, which was
35023502
generated by GNU Autoconf 2.71. Invocation command line was
35033503
35043504
CONFIG_FILES = $CONFIG_FILES
@@ -3553,7 +3553,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
35533553
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
35543554
ac_cs_config='$ac_cs_config_escaped'
35553555
ac_cs_version="\\
3556-
xgboost config.status 1.7.10
3556+
xgboost config.status 1.7.11
35573557
configured by $0, generated by GNU Autoconf 2.71,
35583558
with options \\"\$ac_cs_config\\"
35593559

R-package/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
AC_PREREQ(2.69)
44

5-
AC_INIT([xgboost],[1.7.10],[],[xgboost],[])
5+
AC_INIT([xgboost],[1.7.11],[],[xgboost],[])
66

77
: ${R_HOME=`R RHOME`}
88
if test -z "${R_HOME}"; then

R-package/tests/testthat/test_feature_weights.R

Lines changed: 0 additions & 33 deletions
This file was deleted.

R-package/tests/testthat/test_helpers.R

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -288,72 +288,6 @@ test_that("xgb.model.dt.tree throws error for gblinear", {
288288
expect_error(xgb.model.dt.tree(model = bst.GLM))
289289
})
290290

291-
test_that("xgb.importance works with and without feature names", {
292-
importance.Tree <- xgb.importance(feature_names = feature.names, model = bst.Tree)
293-
if (!flag_32bit)
294-
expect_equal(dim(importance.Tree), c(7, 4))
295-
expect_equal(colnames(importance.Tree), c("Feature", "Gain", "Cover", "Frequency"))
296-
expect_output(str(importance.Tree), 'Feature.*\\"Age\\"')
297-
298-
importance.Tree.0 <- xgb.importance(model = bst.Tree)
299-
expect_equal(importance.Tree, importance.Tree.0, tolerance = float_tolerance)
300-
301-
# when model contains no feature names:
302-
bst.Tree.x <- bst.Tree
303-
bst.Tree.x$feature_names <- NULL
304-
importance.Tree.x <- xgb.importance(model = bst.Tree)
305-
expect_equal(importance.Tree[, -1, with = FALSE], importance.Tree.x[, -1, with = FALSE],
306-
tolerance = float_tolerance)
307-
308-
imp2plot <- xgb.plot.importance(importance_matrix = importance.Tree)
309-
expect_equal(colnames(imp2plot), c("Feature", "Gain", "Cover", "Frequency", "Importance"))
310-
xgb.ggplot.importance(importance_matrix = importance.Tree)
311-
312-
# for multiclass
313-
imp.Tree <- xgb.importance(model = mbst.Tree)
314-
expect_equal(dim(imp.Tree), c(4, 4))
315-
316-
trees <- seq(from = 0, by = 2, length.out = 2)
317-
importance <- xgb.importance(feature_names = feature.names, model = bst.Tree, trees = trees)
318-
319-
importance_from_dump <- function() {
320-
model_text_dump <- xgb.dump(model = bst.Tree, with_stats = TRUE, trees = trees)
321-
imp <- xgb.model.dt.tree(
322-
feature_names = feature.names,
323-
text = model_text_dump,
324-
trees = trees
325-
)[
326-
Feature != "Leaf", .(
327-
Gain = sum(Quality),
328-
Cover = sum(Cover),
329-
Frequency = .N
330-
),
331-
by = Feature
332-
][
333-
, `:=`(
334-
Gain = Gain / sum(Gain),
335-
Cover = Cover / sum(Cover),
336-
Frequency = Frequency / sum(Frequency)
337-
)
338-
][
339-
order(Gain, decreasing = TRUE)
340-
]
341-
imp
342-
}
343-
expect_equal(importance_from_dump(), importance, tolerance = 1e-6)
344-
345-
## decision stump
346-
m <- xgboost::xgboost(
347-
data = as.matrix(data.frame(x = c(0, 1))),
348-
label = c(1, 2),
349-
nrounds = 1,
350-
nthread = 2
351-
)
352-
df <- xgb.model.dt.tree(model = m)
353-
expect_equal(df$Feature, "Leaf")
354-
expect_equal(df$Cover, 2)
355-
})
356-
357291
test_that("xgb.importance works with GLM model", {
358292
importance.GLM <- xgb.importance(feature_names = feature.names, model = bst.GLM)
359293
expect_equal(dim(importance.GLM), c(10, 2))

R-package/tests/testthat/test_interaction_constraints.R

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,6 @@ x3 <- sample(c(1, 2, 3), size = 1000, replace = TRUE)
1111
y <- x1 + x2 + x3 + x1 * x2 * x3 + rnorm(1000, 0.001) + 3 * sin(x1)
1212
train <- matrix(c(x1, x2, x3), ncol = 3)
1313

14-
test_that("interaction constraints for regression", {
15-
# Fit a model that only allows interaction between x1 and x2
16-
bst <- xgboost(data = train, label = y, max_depth = 3,
17-
eta = 0.1, nthread = 2, nrounds = 100, verbose = 0,
18-
interaction_constraints = list(c(0, 1)))
19-
20-
# Set all observations to have the same x3 values then increment
21-
# by the same amount
22-
preds <- lapply(c(1, 2, 3), function(x){
23-
tmat <- matrix(c(x1, x2, rep(x, 1000)), ncol = 3)
24-
return(predict(bst, tmat))
25-
})
26-
27-
# Check incrementing x3 has the same effect on all observations
28-
# since x3 is constrained to be independent of x1 and x2
29-
# and all observations start off from the same x3 value
30-
diff1 <- preds[[2]] - preds[[1]]
31-
test1 <- all(abs(diff1 - diff1[1]) < 1e-4)
32-
33-
diff2 <- preds[[3]] - preds[[2]]
34-
test2 <- all(abs(diff2 - diff2[1]) < 1e-4)
35-
36-
expect_true({
37-
test1 & test2
38-
}, "Interaction Contraint Satisfied")
39-
})
40-
4114
test_that("interaction constraints scientific representation", {
4215
rows <- 10
4316
## When number exceeds 1e5, R paste function uses scientific representation.

R-package/tests/testthat/test_interactions.R

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,6 @@ require(xgboost)
55
set.seed(123)
66
n_threads <- 2
77

8-
test_that("predict feature interactions works", {
9-
# simulate some binary data and a linear outcome with an interaction term
10-
N <- 1000
11-
P <- 5
12-
X <- matrix(rbinom(N * P, 1, 0.5), ncol = P, dimnames = list(NULL, letters[1:P]))
13-
# center the data (as contributions are computed WRT feature means)
14-
X <- scale(X, scale = FALSE)
15-
16-
# outcome without any interactions, without any noise:
17-
f <- function(x) 2 * x[, 1] - 3 * x[, 2]
18-
# outcome with interactions, without noise:
19-
f_int <- function(x) f(x) + 2 * x[, 2] * x[, 3]
20-
# outcome with interactions, with noise:
21-
#f_int_noise <- function(x) f_int(x) + rnorm(N, 0, 0.3)
22-
23-
y <- f_int(X)
24-
25-
dm <- xgb.DMatrix(X, label = y, nthread = n_threads)
26-
param <- list(
27-
eta = 0.1, max_depth = 4, base_score = mean(y), lambda = 0, nthread = n_threads
28-
)
29-
b <- xgb.train(param, dm, 100)
30-
31-
pred <- predict(b, dm, outputmargin = TRUE)
32-
33-
# SHAP contributions:
34-
cont <- predict(b, dm, predcontrib = TRUE)
35-
expect_equal(dim(cont), c(N, P + 1))
36-
# make sure for each row they add up to marginal predictions
37-
expect_lt(max(abs(rowSums(cont) - pred)), 0.001)
38-
# Hand-construct the 'ground truth' feature contributions:
39-
gt_cont <- cbind(
40-
2. * X[, 1],
41-
-3. * X[, 2] + 1. * X[, 2] * X[, 3], # attribute a HALF of the interaction term to feature #2
42-
1. * X[, 2] * X[, 3] # and another HALF of the interaction term to feature #3
43-
)
44-
gt_cont <- cbind(gt_cont, matrix(0, nrow = N, ncol = P + 1 - 3))
45-
# These should be relatively close:
46-
expect_lt(max(abs(cont - gt_cont)), 0.05)
47-
48-
49-
# SHAP interaction contributions:
50-
intr <- predict(b, dm, predinteraction = TRUE)
51-
expect_equal(dim(intr), c(N, P + 1, P + 1))
52-
# check assigned colnames
53-
cn <- c(letters[1:P], "BIAS")
54-
expect_equal(dimnames(intr), list(NULL, cn, cn))
55-
56-
# check the symmetry
57-
expect_lt(max(abs(aperm(intr, c(1, 3, 2)) - intr)), 0.00001)
58-
59-
# sums WRT columns must be close to feature contributions
60-
expect_lt(max(abs(apply(intr, c(1, 2), sum) - cont)), 0.00001)
61-
62-
# diagonal terms for features 3,4,5 must be close to zero
63-
expect_lt(Reduce(max, sapply(3:P, function(i) max(abs(intr[, i, i])))), 0.05)
64-
65-
# BIAS must have no interactions
66-
expect_lt(max(abs(intr[, 1:P, P + 1])), 0.00001)
67-
68-
# interactions other than 2 x 3 must be close to zero
69-
intr23 <- intr
70-
intr23[, 2, 3] <- 0
71-
expect_lt(
72-
Reduce(max, sapply(1:P, function(i) max(abs(intr23[, i, (i + 1):(P + 1)])))),
73-
0.05
74-
)
75-
76-
# Construct the 'ground truth' contributions of interactions directly from the linear terms:
77-
gt_intr <- array(0, c(N, P + 1, P + 1))
78-
gt_intr[, 2, 3] <- 1. * X[, 2] * X[, 3] # attribute a HALF of the interaction term to each symmetric element
79-
gt_intr[, 3, 2] <- gt_intr[, 2, 3]
80-
# merge-in the diagonal based on 'ground truth' feature contributions
81-
intr_diag <- gt_cont - apply(gt_intr, c(1, 2), sum)
82-
for (j in seq_len(P)) {
83-
gt_intr[, j, j] <- intr_diag[, j]
84-
}
85-
# These should be relatively close:
86-
expect_lt(max(abs(intr - gt_intr)), 0.1)
87-
})
88-
898
test_that("SHAP contribution values are not NAN", {
909
d <- data.frame(
9110
x1 = c(-2.3, 1.4, 5.9, 2, 2.5, 0.3, -3.6, -0.2, 0.5, -2.8, -4.6, 3.3, -1.2,

R-package/tests/testthat/test_monotone.R

Lines changed: 0 additions & 23 deletions
This file was deleted.

R-package/tests/testthat/test_poisson_regression.R

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)