[jvm-packages] Cleanup xgboost4j (#10627)

This commit is contained in:
Bobby Wang 2024-07-23 13:57:10 +08:00 committed by GitHub
parent 003b418312
commit b3ed81877a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 14 deletions

View File

@ -89,7 +89,7 @@ public class RabitTracker implements ITracker {
this.trackerDaemon = new Thread(() -> {
try {
waitFor(0);
} catch (XGBoostError ex) {
} catch (Exception ex) {
logger.error(ex);
return; // exit the thread
}

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 by Contributors
Copyright (c) 2014-2024 by Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -16,13 +16,15 @@
package ml.dmlc.xgboost4j.scala
import com.esotericsoftware.kryo.io.{Output, Input}
import com.esotericsoftware.kryo.{Kryo, KryoSerializable}
import ml.dmlc.xgboost4j.java.{Booster => JBooster}
import ml.dmlc.xgboost4j.java.XGBoostError
import scala.collection.JavaConverters._
import scala.collection.mutable
import com.esotericsoftware.kryo.{Kryo, KryoSerializable}
import com.esotericsoftware.kryo.io.{Input, Output}
import ml.dmlc.xgboost4j.java.{Booster => JBooster}
import ml.dmlc.xgboost4j.java.XGBoostError
/**
* Booster for xgboost, this is a model API that support interactive build of a XGBoost Model
*

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2014 by Contributors
Copyright (c) 2024 by Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -16,9 +16,10 @@
package ml.dmlc.xgboost4j.scala
import ml.dmlc.xgboost4j.java.{ExternalCheckpointManager => JavaECM}
import org.apache.hadoop.fs.FileSystem
import ml.dmlc.xgboost4j.java.{ExternalCheckpointManager => JavaECM}
class ExternalCheckpointManager(checkpointPath: String, fs: FileSystem)
extends JavaECM(checkpointPath, fs) {

View File

@ -17,12 +17,14 @@
package ml.dmlc.xgboost4j.scala
import java.io.InputStream
import ml.dmlc.xgboost4j.java.{XGBoostError, XGBoost => JXGBoost}
import scala.jdk.CollectionConverters._
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import ml.dmlc.xgboost4j.java.{XGBoost => JXGBoost, XGBoostError}
/**
* XGBoost Scala Training function.
*/

View File

@ -21,6 +21,7 @@ import java.util.Arrays
import scala.util.Random
import org.scalatest.funsuite.AnyFunSuite
import ml.dmlc.xgboost4j.java.{DMatrix => JDMatrix}
class DMatrixSuite extends AnyFunSuite {

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 by Contributors
Copyright (c) 2014-2024 by Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
package ml.dmlc.xgboost4j.scala
import java.io.{FileOutputStream, FileInputStream, File}
import java.io.{File, FileInputStream, FileOutputStream}
import junit.framework.TestCase
import org.apache.commons.logging.LogFactory
@ -169,7 +169,6 @@ class ScalaBoosterImplSuite extends AnyFunSuite {
test("test with quantile histo lossguide with max bin") {
val trainMat = new DMatrix("../../demo/data/agaricus.txt.train?format=libsvm")
val testMat = new DMatrix("../../demo/data/agaricus.txt.test?format=libsvm")
val paramMap = List("max_depth" -> "3", "silent" -> "0",
"objective" -> "binary:logistic", "tree_method" -> "hist",
"grow_policy" -> "lossguide", "max_leaves" -> "8", "max_bin" -> "16",
@ -180,7 +179,6 @@ class ScalaBoosterImplSuite extends AnyFunSuite {
test("test with quantile histo depthwidth with max depth") {
val trainMat = new DMatrix("../../demo/data/agaricus.txt.train?format=libsvm")
val testMat = new DMatrix("../../demo/data/agaricus.txt.test?format=libsvm")
val paramMap = List("max_depth" -> "0", "silent" -> "0",
"objective" -> "binary:logistic", "tree_method" -> "hist",
"grow_policy" -> "depthwise", "max_leaves" -> "8", "max_depth" -> "2",
@ -191,7 +189,6 @@ class ScalaBoosterImplSuite extends AnyFunSuite {
test("test with quantile histo depthwidth with max depth and max bin") {
val trainMat = new DMatrix("../../demo/data/agaricus.txt.train?format=libsvm")
val testMat = new DMatrix("../../demo/data/agaricus.txt.test?format=libsvm")
val paramMap = List("max_depth" -> "0", "silent" -> "0",
"objective" -> "binary:logistic", "tree_method" -> "hist",
"grow_policy" -> "depthwise", "max_depth" -> "2", "max_bin" -> "2",