Use DART tree weights when computing SHAPs (#5050)

This PR fixes tree weights in dart being ignored when computing contributions.

* Fix ellpack page source link.
* Add tree weights to compute contribution.
This commit is contained in:
Kodi Arfer
2019-12-03 06:55:53 -05:00
committed by Jiaming Yuan
parent 64f4361b47
commit f2277e7106
12 changed files with 88 additions and 16 deletions

View File

@@ -348,6 +348,23 @@ class Dart : public GBTree {
return GBTree::UseGPU();
}
void PredictContribution(DMatrix* p_fmat,
std::vector<bst_float>* out_contribs,
unsigned ntree_limit, bool approximate, int condition,
unsigned condition_feature) override {
CHECK(configured_);
cpu_predictor_->PredictContribution(p_fmat, out_contribs, model_,
ntree_limit, &weight_drop_, approximate);
}
void PredictInteractionContributions(DMatrix* p_fmat,
std::vector<bst_float>* out_contribs,
unsigned ntree_limit, bool approximate) override {
CHECK(configured_);
cpu_predictor_->PredictInteractionContributions(p_fmat, out_contribs, model_,
ntree_limit, &weight_drop_, approximate);
}
protected:
friend class GBTree;
// internal prediction loop

View File

@@ -216,7 +216,8 @@ class GBTree : public GradientBooster {
unsigned ntree_limit, bool approximate, int condition,
unsigned condition_feature) override {
CHECK(configured_);
cpu_predictor_->PredictContribution(p_fmat, out_contribs, model_, ntree_limit, approximate);
cpu_predictor_->PredictContribution(p_fmat, out_contribs, model_,
ntree_limit, nullptr, approximate);
}
void PredictInteractionContributions(DMatrix* p_fmat,
@@ -224,7 +225,7 @@ class GBTree : public GradientBooster {
unsigned ntree_limit, bool approximate) override {
CHECK(configured_);
cpu_predictor_->PredictInteractionContributions(p_fmat, out_contribs, model_,
ntree_limit, approximate);
ntree_limit, nullptr, approximate);
}
std::vector<std::string> DumpModel(const FeatureMap& fmap,