adding feature contributions to R and gblinear (#2295)
* [gblinear] add features contribution prediction; fix DumpModel bug * [gbtree] minor changes to PredContrib * [R] add feature contribution prediction to R * [R] bump up version; update NEWS * [gblinear] fix the base_margin issue; fixes #1969 * [R] list of matrices as output of multiclass feature contributions * [gblinear] make order of DumpModel coefficients consistent: group index changes the fastest
This commit is contained in:
committed by
Yuan (Terry) Tang
parent
e5e721722e
commit
b52db87d5c
@@ -384,7 +384,7 @@ XGB_DLL int XGBoosterEvalOneIter(BoosterHandle handle,
|
||||
* 0:normal prediction
|
||||
* 1:output margin instead of transformed value
|
||||
* 2:output leaf index of trees instead of leaf value, note leaf index is unique per tree
|
||||
* 4:output feature contributions of all trees instead of predictions
|
||||
* 4:output feature contributions to individual predictions
|
||||
* \param ntree_limit limit number of trees used for prediction, this is only valid for boosted trees
|
||||
* when the parameter is set to 0, we will use all the trees
|
||||
* \param out_len used to store length of returning result
|
||||
|
||||
@@ -109,8 +109,8 @@ class GradientBooster {
|
||||
unsigned ntree_limit = 0) = 0;
|
||||
|
||||
/*!
|
||||
* \brief predict the feature contributions of each tree, the output will be nsample * (nfeats + 1) vector
|
||||
* this is only valid in gbtree predictor
|
||||
* \brief feature contributions to individual predictions; the output will be a vector
|
||||
* of length (nfeats + 1) * num_output_group * nsample, arranged in that order
|
||||
* \param dmat feature matrix
|
||||
* \param out_contribs output vector to hold the contributions
|
||||
* \param ntree_limit limit the number of trees used in prediction, when it equals 0, this means
|
||||
|
||||
@@ -103,7 +103,7 @@ class Learner : public rabit::Serializable {
|
||||
* \param ntree_limit limit number of trees used for boosted tree
|
||||
* predictor, when it equals 0, this means we are using all the trees
|
||||
* \param pred_leaf whether to only predict the leaf index of each tree in a boosted tree predictor
|
||||
* \param pred_contribs whether to only predict the feature contributions of all trees
|
||||
* \param pred_contribs whether to only predict the feature contributions
|
||||
*/
|
||||
virtual void Predict(DMatrix* data,
|
||||
bool output_margin,
|
||||
|
||||
Reference in New Issue
Block a user