Skip to content

Commit aec6299

Browse files
yanboliangCodingCat
authored andcommitted
[jvm-packages] Expose nativeBooster for XGBoostClassificationModel and XGBoostRegressionModel. (dmlc#3428)
1 parent 2952522 commit aec6299

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostClassifier.scala

+6
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ class XGBoostClassificationModel private[ml](
211211
// only called in copy()
212212
def this(uid: String) = this(uid, 2, null)
213213

214+
/**
215+
* Get the native booster instance of this model.
216+
* This is used to call low-level APIs on native booster, such as "getFeatureScore".
217+
*/
218+
def nativeBooster: Booster = _booster
219+
214220
private var trainingSummary: Option[XGBoostTrainingSummary] = None
215221

216222
/**

jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRegressor.scala

+6
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ class XGBoostRegressionModel private[ml] (
207207
// only called in copy()
208208
def this(uid: String) = this(uid, null)
209209

210+
/**
211+
* Get the native booster instance of this model.
212+
* This is used to call low-level APIs on native booster, such as "getFeatureScore".
213+
*/
214+
def nativeBooster: Booster = _booster
215+
210216
private var trainingSummary: Option[XGBoostTrainingSummary] = None
211217

212218
/**

0 commit comments

Comments
 (0)