-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jvm-packages] rework xgboost4j-spark and xgboost4j-spark-gpu
- Loading branch information
Showing
58 changed files
with
3,953 additions
and
7,153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
...xgboost4j-spark-gpu/src/main/java/ml/dmlc/xgboost4j/java/nvidia/spark/GpuColumnBatch.java
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...gpu/src/main/resources/META-INF/services/ml.dmlc.xgboost4j.scala.spark.PreXGBoostProvider
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...park-gpu/src/main/resources/META-INF/services/ml.dmlc.xgboost4j.scala.spark.XGBoostPlugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ml.dmlc.xgboost4j.scala.spark.GpuXGBoostPlugin |
112 changes: 112 additions & 0 deletions
112
...packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/QuantileDMatrix.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
Copyright (c) 2021-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. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package ml.dmlc.xgboost4j.scala | ||
|
||
import _root_.scala.collection.JavaConverters._ | ||
|
||
import ml.dmlc.xgboost4j.java.{Column, ColumnBatch, QuantileDMatrix => JQuantileDMatrix, XGBoostError} | ||
|
||
class QuantileDMatrix private[scala]( | ||
private[scala] override val jDMatrix: JQuantileDMatrix) extends DMatrix(jDMatrix) { | ||
|
||
/** | ||
* Create QuantileDMatrix from iterator based on the array interface | ||
* | ||
* @param iter the XGBoost ColumnBatch batch to provide the corresponding array interface | ||
* @param missing the missing value | ||
* @param maxBin the max bin | ||
* @param nthread the parallelism | ||
* @throws XGBoostError | ||
*/ | ||
def this(iter: Iterator[ColumnBatch], missing: Float, maxBin: Int, nthread: Int) { | ||
this(new JQuantileDMatrix(iter.asJava, missing, maxBin, nthread)) | ||
} | ||
|
||
/** | ||
* set label of dmatrix | ||
* | ||
* @param labels labels | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setLabel(labels: Array[Float]): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setLabel.") | ||
|
||
/** | ||
* set weight of each instance | ||
* | ||
* @param weights weights | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setWeight(weights: Array[Float]): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setWeight.") | ||
|
||
/** | ||
* if specified, xgboost will start from this init margin | ||
* can be used to specify initial prediction to boost from | ||
* | ||
* @param baseMargin base margin | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setBaseMargin(baseMargin: Array[Float]): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setBaseMargin.") | ||
|
||
/** | ||
* if specified, xgboost will start from this init margin | ||
* can be used to specify initial prediction to boost from | ||
* | ||
* @param baseMargin base margin | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setBaseMargin(baseMargin: Array[Array[Float]]): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setBaseMargin.") | ||
|
||
/** | ||
* Set group sizes of DMatrix (used for ranking) | ||
* | ||
* @param group group size as array | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setGroup(group: Array[Int]): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setGroup.") | ||
|
||
/** | ||
* Set label of DMatrix from array interface | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setLabel(column: Column): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setLabel.") | ||
|
||
/** | ||
* set weight of dmatrix from column array interface | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setWeight(column: Column): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setWeight.") | ||
|
||
/** | ||
* set base margin of dmatrix from column array interface | ||
*/ | ||
@throws(classOf[XGBoostError]) | ||
override def setBaseMargin(column: Column): Unit = | ||
throw new XGBoostError("QuantileDMatrix does not support setBaseMargin.") | ||
|
||
@throws(classOf[XGBoostError]) | ||
override def setQueryId(column: Column): Unit = { | ||
throw new XGBoostError("QuantileDMatrix does not support setQueryId.") | ||
} | ||
|
||
} |
Oops, something went wrong.