[jvm-packages] Expose prediction feature contribution on the Java side (#2441)
* Exposed prediction feature contribution on the Java side * was not supplying the newly added argument * Exposed from Scala-side as well * formatting (keep declaration in one line unless exceeding 100 chars)
This commit is contained in:
@@ -135,11 +135,23 @@ class Booster private[xgboost4j](private var booster: JBooster)
|
||||
* @throws XGBoostError native error
|
||||
*/
|
||||
@throws(classOf[XGBoostError])
|
||||
def predictLeaf(data: DMatrix, treeLimit: Int = 0)
|
||||
: Array[Array[Float]] = {
|
||||
def predictLeaf(data: DMatrix, treeLimit: Int = 0) : Array[Array[Float]] = {
|
||||
booster.predictLeaf(data.jDMatrix, treeLimit)
|
||||
}
|
||||
|
||||
/**
|
||||
* Output feature contributions toward predictions of given data
|
||||
*
|
||||
* @param data dmatrix storing the input
|
||||
* @param treeLimit Limit number of trees in the prediction; defaults to 0 (use all trees).
|
||||
* @return The feature contributions and bias.
|
||||
* @throws XGBoostError native error
|
||||
*/
|
||||
@throws(classOf[XGBoostError])
|
||||
def predictContrib(data: DMatrix, treeLimit: Int = 0) : Array[Array[Float]] = {
|
||||
booster.predictContrib(data.jDMatrix, treeLimit)
|
||||
}
|
||||
|
||||
/**
|
||||
* save model to modelPath
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user