Merge branch 'master' into dev-hui
This commit is contained in:
@@ -164,7 +164,7 @@ struct GHistIndexMatrixView {
|
||||
SparsePage::Inst operator[](size_t r) {
|
||||
auto t = omp_get_thread_num();
|
||||
auto const beg = (n_features_ * kUnroll * t) + (current_unroll_[t] * n_features_);
|
||||
size_t non_missing{beg};
|
||||
size_t non_missing{static_cast<std::size_t>(beg)};
|
||||
|
||||
for (bst_feature_t c = 0; c < n_features_; ++c) {
|
||||
float f = page_.GetFvalue(r, c, common::IsCat(ft_, c));
|
||||
@@ -477,7 +477,8 @@ class ColumnSplitHelper {
|
||||
// auto block_id has the same type as `n_blocks`.
|
||||
common::ParallelFor(n_blocks, n_threads_, [&](auto block_id) {
|
||||
auto const batch_offset = block_id * block_of_rows_size;
|
||||
auto const block_size = std::min(nsize - batch_offset, block_of_rows_size);
|
||||
auto const block_size = std::min(static_cast<std::size_t>(nsize - batch_offset),
|
||||
static_cast<std::size_t>(block_of_rows_size));
|
||||
auto const fvec_offset = omp_get_thread_num() * block_of_rows_size;
|
||||
|
||||
FVecFill(block_size, batch_offset, num_feature, &batch, fvec_offset, &feat_vecs_);
|
||||
@@ -490,7 +491,8 @@ class ColumnSplitHelper {
|
||||
// auto block_id has the same type as `n_blocks`.
|
||||
common::ParallelFor(n_blocks, n_threads_, [&](auto block_id) {
|
||||
auto const batch_offset = block_id * block_of_rows_size;
|
||||
auto const block_size = std::min(nsize - batch_offset, block_of_rows_size);
|
||||
auto const block_size = std::min(static_cast<std::size_t>(nsize - batch_offset),
|
||||
static_cast<std::size_t>(block_of_rows_size));
|
||||
PredictAllTrees(out_preds, batch_offset, batch_offset + batch.base_rowid, num_group,
|
||||
block_size);
|
||||
});
|
||||
@@ -584,7 +586,7 @@ class CPUPredictor : public Predictor {
|
||||
|
||||
void PredictDMatrix(DMatrix *p_fmat, std::vector<bst_float> *out_preds,
|
||||
gbm::GBTreeModel const &model, int32_t tree_begin, int32_t tree_end) const {
|
||||
if (p_fmat->Info().data_split_mode == DataSplitMode::kCol) {
|
||||
if (p_fmat->IsColumnSplit()) {
|
||||
ColumnSplitHelper helper(this->ctx_->Threads(), model, tree_begin, tree_end);
|
||||
helper.PredictDMatrix(p_fmat, out_preds);
|
||||
return;
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
*/
|
||||
#include "cpu_treeshap.h"
|
||||
|
||||
#include <cinttypes> // std::uint32_t
|
||||
#include <algorithm> // copy
|
||||
#include <cinttypes> // std::uint32_t
|
||||
|
||||
#include "predict_fn.h" // GetNextNode
|
||||
#include "xgboost/base.h" // bst_node_t
|
||||
#include "predict_fn.h" // GetNextNode
|
||||
#include "xgboost/base.h" // bst_node_t
|
||||
#include "xgboost/logging.h"
|
||||
#include "xgboost/tree_model.h" // RegTree
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef XGBOOST_PREDICTOR_CPU_TREESHAP_H_
|
||||
#define XGBOOST_PREDICTOR_CPU_TREESHAP_H_
|
||||
/**
|
||||
* Copyright by XGBoost Contributors 2017-2022
|
||||
*/
|
||||
#include <vector> // vector
|
||||
|
||||
#include "xgboost/tree_model.h" // RegTree
|
||||
|
||||
namespace xgboost {
|
||||
@@ -15,3 +19,4 @@ void CalculateContributions(RegTree const &tree, const RegTree::FVec &feat,
|
||||
std::vector<float> *mean_values, bst_float *out_contribs, int condition,
|
||||
unsigned condition_feature);
|
||||
} // namespace xgboost
|
||||
#endif // XGBOOST_PREDICTOR_CPU_TREESHAP_H_
|
||||
|
||||
Reference in New Issue
Block a user