Unverified Commit 71a1a4f6 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] fix learning-to-rank tests on Solaris (#3534)



* [R-package] fix learning-to-rank tests on Solaris

* Update R-package/tests/testthat/test_learning_to_rank.R
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent c0ffb71e
......@@ -3,6 +3,8 @@ context("Learning to rank")
# numerical tolerance to use when checking metric values
TOLERANCE <- 1e-06
ON_SOLARIS <- Sys.info()["sysname"] == "SunOS"
test_that("learning-to-rank with lgb.train() works as expected", {
set.seed(708L)
data(agaricus.train, package = "lightgbm")
......@@ -46,11 +48,14 @@ test_that("learning-to-rank with lgb.train() works as expected", {
}
expect_identical(sapply(eval_results, function(x) {x$name}), eval_names)
expect_equal(eval_results[[1L]][["value"]], 0.775)
expect_true(abs(eval_results[[2L]][["value"]] - 0.745986) < TOLERANCE)
expect_true(abs(eval_results[[3L]][["value"]] - 0.7351959) < TOLERANCE)
if (!ON_SOLARIS) {
expect_true(abs(eval_results[[2L]][["value"]] - 0.745986) < TOLERANCE)
expect_true(abs(eval_results[[3L]][["value"]] - 0.7351959) < TOLERANCE)
}
})
test_that("learning-to-rank with lgb.cv() works as expected", {
testthat::skip_if(ON_SOLARIS, message = "Skipping on Solaris")
set.seed(708L)
data(agaricus.train, package = "lightgbm")
# just keep a few features,to generate an model with imperfect fit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment