[R] Fix global feature importance and predict with 1 sample. (#7394)
* [R] Fix global feature importance. * Add implementation for tree index. The parameter is not documented in C API since we should work on porting the model slicing to R instead of supporting more use of tree index. * Fix the difference between "gain" and "total_gain". * debug. * Fix prediction.
This commit is contained in:
@@ -182,9 +182,10 @@ class GradientBooster : public Model, public Configurable {
|
||||
bool with_stats,
|
||||
std::string format) const = 0;
|
||||
|
||||
virtual void FeatureScore(std::string const &importance_type,
|
||||
std::vector<bst_feature_t> *features,
|
||||
std::vector<float> *scores) const = 0;
|
||||
virtual void FeatureScore(std::string const& importance_type,
|
||||
common::Span<int32_t const> trees,
|
||||
std::vector<bst_feature_t>* features,
|
||||
std::vector<float>* scores) const = 0;
|
||||
/*!
|
||||
* \brief Whether the current booster uses GPU.
|
||||
*/
|
||||
|
||||
@@ -156,9 +156,10 @@ class Learner : public Model, public Configurable, public dmlc::Serializable {
|
||||
/*!
|
||||
* \brief Calculate feature score. See doc in C API for outputs.
|
||||
*/
|
||||
virtual void CalcFeatureScore(std::string const &importance_type,
|
||||
std::vector<bst_feature_t> *features,
|
||||
std::vector<float> *scores) = 0;
|
||||
virtual void CalcFeatureScore(std::string const& importance_type,
|
||||
common::Span<int32_t const> trees,
|
||||
std::vector<bst_feature_t>* features,
|
||||
std::vector<float>* scores) = 0;
|
||||
|
||||
/*
|
||||
* \brief Get number of boosted rounds from gradient booster.
|
||||
|
||||
Reference in New Issue
Block a user