Go to the documentation of this file.
11 #include <dmlc/registry.h>
22 #include <unordered_map>
31 struct GenericParameter;
32 struct LearnerModelParam;
33 struct PredictionCacheEntry;
34 class PredictionContainer;
52 virtual void Configure(
const std::vector<std::pair<std::string, std::string> >& cfg) = 0;
57 virtual void Load(dmlc::Stream* fi) = 0;
62 virtual void Save(dmlc::Stream* fo)
const = 0;
70 virtual void Slice(int32_t layer_begin, int32_t layer_end, int32_t step,
72 LOG(FATAL) <<
"Slice is not supported by current booster.";
107 unsigned ntree_limit = 0) = 0;
122 LOG(FATAL) <<
"Inplace predict is not supported by current booster.";
136 std::vector<bst_float>* out_preds,
137 unsigned ntree_limit = 0) = 0;
148 unsigned ntree_limit = 0) = 0;
163 unsigned ntree_limit = 0,
164 bool approximate =
false,
int condition = 0,
165 unsigned condition_feature = 0) = 0;
169 unsigned ntree_limit,
bool approximate) = 0;
180 std::string format)
const = 0;
184 virtual bool UseGPU()
const = 0;
193 const std::string& name,
202 :
public dmlc::FunctionRegEntryBase<
204 std::function<GradientBooster* (LearnerModelParam const* learner_model_param)> > {
219 #define XGBOOST_REGISTER_GBM(UniqueId, Name) \
220 static DMLC_ATTRIBUTE_UNUSED ::xgboost::GradientBoosterReg & \
221 __make_ ## GradientBoosterReg ## _ ## UniqueId ## __ = \
222 ::dmlc::Registry< ::xgboost::GradientBoosterReg>::Get()->__REGISTER__(Name)
225 #endif // XGBOOST_GBM_H_
Contains pointer to input matrix and associated cached predictions.
Definition: predictor.h:35
Defines the abstract interface for different components in XGBoost.
GenericParameter const * generic_param_
Definition: gbm.h:41
Definition: generic_parameters.h:15
Definition: host_device_vector.h:86
A device-and-host vector abstraction layer.
~GradientBooster() override=default
virtual destructor
virtual void Load(dmlc::Stream *fi)=0
load model from stream
defines configuration macros of xgboost.
virtual void Slice(int32_t layer_begin, int32_t layer_end, int32_t step, GradientBooster *out, bool *out_of_bound) const
Slice a model using boosting index. The slice m:n indicates taking all trees that were fit during the...
Definition: gbm.h:70
interface of gradient boosting model.
Definition: gbm.h:39
Internal data structured used by XGBoost during training.
Definition: data.h:454
Definition: learner.h:252
Feature map data structure to help text model dump. TODO(tqchen) consider make it even more lightweig...
Definition: feature_map.h:22
virtual void InplacePredict(dmlc::any const &, float, PredictionCacheEntry *, uint32_t, uint32_t) const
Inplace prediction.
Definition: gbm.h:118
virtual void DoBoost(DMatrix *p_fmat, HostDeviceVector< GradientPair > *in_gpair, PredictionCacheEntry *)=0
perform update to the model(boosting)
virtual void PredictLeaf(DMatrix *dmat, HostDeviceVector< bst_float > *out_preds, unsigned ntree_limit=0)=0
predict the leaf index of each tree, the output will be nsample * ntree vector this is only valid in ...
virtual void PredictInstance(const SparsePage::Inst &inst, std::vector< bst_float > *out_preds, unsigned ntree_limit=0)=0
online prediction function, predict score for one instance at a time NOTE: use the batch prediction i...
virtual void Configure(const std::vector< std::pair< std::string, std::string > > &cfg)=0
Set the configuration of gradient boosting. User must call configure once before InitModel and Traini...
virtual void PredictInteractionContributions(DMatrix *dmat, HostDeviceVector< bst_float > *out_contribs, unsigned ntree_limit, bool approximate)=0
virtual void PredictContribution(DMatrix *dmat, HostDeviceVector< bst_float > *out_contribs, unsigned ntree_limit=0, bool approximate=false, int condition=0, unsigned condition_feature=0)=0
feature contributions to individual predictions; the output will be a vector of length (nfeats + 1) *...
span class implementation, based on ISO++20 span<T>. The interface should be the same.
Definition: span.h:137
virtual bool UseGPU() const =0
Whether the current booster uses GPU.
The input data structure of xgboost.
virtual std::vector< std::string > DumpModel(const FeatureMap &fmap, bool with_stats, std::string format) const =0
dump the model in the requested format
virtual void PredictBatch(DMatrix *dmat, PredictionCacheEntry *out_preds, bool training, unsigned ntree_limit=0)=0
generate predictions for given feature matrix
Registry entry for tree updater.
Definition: gbm.h:201
virtual bool AllowLazyCheckPoint() const
whether the model allow lazy checkpoint return true if model is only updated in DoBoost after all All...
Definition: gbm.h:79
static GradientBooster * Create(const std::string &name, GenericParameter const *generic_param, LearnerModelParam const *learner_model_param)
create a gradient booster from given name
virtual void Save(dmlc::Stream *fo) const =0
save model to stream.
namespace of xgboost
Definition: base.h:110