[jvm-packages] Cleanup xgboost4j (#10627)
This commit is contained in:
parent
003b418312
commit
b3ed81877a
@ -89,7 +89,7 @@ public class RabitTracker implements ITracker {
|
|||||||
this.trackerDaemon = new Thread(() -> {
|
this.trackerDaemon = new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
waitFor(0);
|
waitFor(0);
|
||||||
} catch (XGBoostError ex) {
|
} catch (Exception ex) {
|
||||||
logger.error(ex);
|
logger.error(ex);
|
||||||
return; // exit the thread
|
return; // exit the thread
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -16,13 +16,15 @@
|
|||||||
|
|
||||||
package ml.dmlc.xgboost4j.scala
|
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.JavaConverters._
|
||||||
import scala.collection.mutable
|
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
|
* Booster for xgboost, this is a model API that support interactive build of a XGBoost Model
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2014 by Contributors
|
Copyright (c) 2024 by Contributors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -16,9 +16,10 @@
|
|||||||
|
|
||||||
package ml.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import ml.dmlc.xgboost4j.java.{ExternalCheckpointManager => JavaECM}
|
|
||||||
import org.apache.hadoop.fs.FileSystem
|
import org.apache.hadoop.fs.FileSystem
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.java.{ExternalCheckpointManager => JavaECM}
|
||||||
|
|
||||||
class ExternalCheckpointManager(checkpointPath: String, fs: FileSystem)
|
class ExternalCheckpointManager(checkpointPath: String, fs: FileSystem)
|
||||||
extends JavaECM(checkpointPath, fs) {
|
extends JavaECM(checkpointPath, fs) {
|
||||||
|
|
||||||
|
|||||||
@ -17,12 +17,14 @@
|
|||||||
package ml.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import ml.dmlc.xgboost4j.java.{XGBoostError, XGBoost => JXGBoost}
|
|
||||||
|
|
||||||
import scala.jdk.CollectionConverters._
|
import scala.jdk.CollectionConverters._
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration
|
import org.apache.hadoop.conf.Configuration
|
||||||
import org.apache.hadoop.fs.Path
|
import org.apache.hadoop.fs.Path
|
||||||
|
|
||||||
|
import ml.dmlc.xgboost4j.java.{XGBoost => JXGBoost, XGBoostError}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XGBoost Scala Training function.
|
* XGBoost Scala Training function.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.Arrays
|
|||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
import org.scalatest.funsuite.AnyFunSuite
|
import org.scalatest.funsuite.AnyFunSuite
|
||||||
|
|
||||||
import ml.dmlc.xgboost4j.java.{DMatrix => JDMatrix}
|
import ml.dmlc.xgboost4j.java.{DMatrix => JDMatrix}
|
||||||
|
|
||||||
class DMatrixSuite extends AnyFunSuite {
|
class DMatrixSuite extends AnyFunSuite {
|
||||||
|
|||||||
@ -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");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package ml.dmlc.xgboost4j.scala
|
package ml.dmlc.xgboost4j.scala
|
||||||
|
|
||||||
import java.io.{FileOutputStream, FileInputStream, File}
|
import java.io.{File, FileInputStream, FileOutputStream}
|
||||||
|
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.apache.commons.logging.LogFactory
|
import org.apache.commons.logging.LogFactory
|
||||||
@ -169,7 +169,6 @@ class ScalaBoosterImplSuite extends AnyFunSuite {
|
|||||||
|
|
||||||
test("test with quantile histo lossguide with max bin") {
|
test("test with quantile histo lossguide with max bin") {
|
||||||
val trainMat = new DMatrix("../../demo/data/agaricus.txt.train?format=libsvm")
|
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",
|
val paramMap = List("max_depth" -> "3", "silent" -> "0",
|
||||||
"objective" -> "binary:logistic", "tree_method" -> "hist",
|
"objective" -> "binary:logistic", "tree_method" -> "hist",
|
||||||
"grow_policy" -> "lossguide", "max_leaves" -> "8", "max_bin" -> "16",
|
"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") {
|
test("test with quantile histo depthwidth with max depth") {
|
||||||
val trainMat = new DMatrix("../../demo/data/agaricus.txt.train?format=libsvm")
|
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",
|
val paramMap = List("max_depth" -> "0", "silent" -> "0",
|
||||||
"objective" -> "binary:logistic", "tree_method" -> "hist",
|
"objective" -> "binary:logistic", "tree_method" -> "hist",
|
||||||
"grow_policy" -> "depthwise", "max_leaves" -> "8", "max_depth" -> "2",
|
"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") {
|
test("test with quantile histo depthwidth with max depth and max bin") {
|
||||||
val trainMat = new DMatrix("../../demo/data/agaricus.txt.train?format=libsvm")
|
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",
|
val paramMap = List("max_depth" -> "0", "silent" -> "0",
|
||||||
"objective" -> "binary:logistic", "tree_method" -> "hist",
|
"objective" -> "binary:logistic", "tree_method" -> "hist",
|
||||||
"grow_policy" -> "depthwise", "max_depth" -> "2", "max_bin" -> "2",
|
"grow_policy" -> "depthwise", "max_depth" -> "2", "max_bin" -> "2",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user