7#ifndef XGBOOST_DATA_ITERATIVE_DMATRIX_H_
8#define XGBOOST_DATA_ITERATIVE_DMATRIX_H_
15#include "../common/error_msg.h"
16#include "proxy_dmatrix.h"
17#include "simple_batch_iterator.h"
50 std::shared_ptr<EllpackPage> ellpack_;
51 std::shared_ptr<GHistIndexMatrix> ghist_;
60 CHECK_EQ(param.max_bin, batch_.
max_bin) << error::InconsistentMaxBin();
61 CHECK(!param.regen && param.hess.empty())
62 <<
"Only `hist` and `gpu_hist` tree method can use `QuantileDMatrix`.";
65 template <
typename Page>
66 static auto InvalidTreeMethod() {
67 LOG(FATAL) <<
"Only `hist` and `gpu_hist` tree method can use `QuantileDMatrix`.";
71 void InitFromCUDA(
Context const *ctx,
BatchParam const &p, DataIterHandle iter_handle,
72 float missing, std::shared_ptr<DMatrix> ref);
73 void InitFromCPU(
Context const *ctx,
BatchParam const &p, DataIterHandle iter_handle,
74 float missing, std::shared_ptr<DMatrix> ref);
83 bool EllpackExists()
const override {
return static_cast<bool>(ellpack_); }
84 bool GHistIndexExists()
const override {
return static_cast<bool>(ghist_); }
85 bool SparsePageExists()
const override {
return false; }
88 LOG(FATAL) <<
"Slicing DMatrix is not supported for Quantile DMatrix.";
91 DMatrix *SliceCol(
int,
int)
override {
92 LOG(FATAL) <<
"Slicing DMatrix columns is not supported for Quantile DMatrix.";
96 LOG(FATAL) <<
"Not implemented.";
100 return InvalidTreeMethod<CSCPage>();
103 return InvalidTreeMethod<SortedCSCPage>();
110 bool SingleColBlock()
const override {
return true; }
112 MetaInfo &Info()
override {
return info_; }
113 MetaInfo const &Info()
const override {
return info_; }
115 Context const *Ctx()
const override {
return &fmat_ctx_; }
A page stored in ELLPACK format.
Definition ellpack_page.h:21
Definition hist_util.h:37
span class implementation, based on ISO++20 span<T>. The interface should be the same.
Definition span.h:424
DMatrix type for QuantileDMatrix, the naming IterativeDMatix is due to its construction process.
Definition iterative_dmatrix.h:48
Copyright 2014-2023, XGBoost Contributors.
XGB_EXTERN_C typedef int XGDMatrixCallbackNext(DataIterHandle iter)
Callback function prototype for getting next batch of data.
XGB_EXTERN_C typedef void DataIterResetCallback(DataIterHandle handle)
Callback function prototype for resetting external iterator.
Copyright 2015-2023 by XGBoost Contributors.
Copyright 2015-2023 by XGBoost Contributors.
void GetCutsFromRef(Context const *ctx, std::shared_ptr< DMatrix > ref, bst_feature_t n_features, BatchParam p, common::HistogramCuts *p_cuts)
Get quantile cuts from reference (Quantile)DMatrix.
Definition iterative_dmatrix.cc:54
void GetCutsFromEllpack(EllpackPage const &, common::HistogramCuts *)
Get quantile cuts from ellpack page.
Definition iterative_dmatrix.cc:377
namespace of xgboost
Definition base.h:90
uint32_t bst_feature_t
Type for data column (feature) index.
Definition base.h:101
int32_t bst_bin_t
Type for histogram bin index.
Definition base.h:103
Parameters for constructing histogram index batches.
Definition data.h:244
bst_bin_t max_bin
Maximum number of bins per feature for histograms.
Definition data.h:248
Runtime context for XGBoost.
Definition context.h:84
Copyright 2015~2023 by XGBoost Contributors.