11 #include <dmlc/registry.h> 21 #include "../../src/common/host_device_vector.h" 37 template<
typename PairIter>
38 inline void Configure(PairIter begin, PairIter end);
45 virtual void Configure(
const std::vector<std::pair<std::string, std::string> >& cfg) = 0;
50 virtual void Load(dmlc::Stream* fi) = 0;
55 virtual void Save(dmlc::Stream* fo)
const = 0;
84 unsigned ntree_limit = 0) = 0;
98 std::vector<bst_float>* out_preds,
99 unsigned ntree_limit = 0,
100 unsigned root_index = 0) = 0;
110 std::vector<bst_float>* out_preds,
111 unsigned ntree_limit = 0) = 0;
125 std::vector<bst_float>* out_contribs,
126 unsigned ntree_limit = 0,
bool approximate =
false,
127 int condition = 0,
unsigned condition_feature = 0) = 0;
130 std::vector<bst_float>* out_contribs,
131 unsigned ntree_limit,
bool approximate) = 0;
142 std::string format)
const = 0;
151 const std::string& name,
152 const std::vector<std::shared_ptr<DMatrix> >& cache_mats,
157 template<
typename PairIter>
159 std::vector<std::pair<std::string, std::string> > vec(begin, end);
167 :
public dmlc::FunctionRegEntryBase<
169 std::function<GradientBooster* (const std::vector<std::shared_ptr<DMatrix> > &cached_mats,
170 bst_float base_margin)> > {
185 #define XGBOOST_REGISTER_GBM(UniqueId, Name) \ 186 static DMLC_ATTRIBUTE_UNUSED ::xgboost::GradientBoosterReg & \ 187 __make_ ## GradientBoosterReg ## _ ## UniqueId ## __ = \ 188 ::dmlc::Registry< ::xgboost::GradientBoosterReg>::Get()->__REGISTER__(Name) 191 #endif // XGBOOST_GBM_H_ virtual void PredictInstance(const SparsePage::Inst &inst, std::vector< bst_float > *out_preds, unsigned ntree_limit=0, unsigned root_index=0)=0
online prediction function, predict score for one instance at a time NOTE: use the batch prediction i...
float bst_float
float type, used for storing statistics
Definition: base.h:89
void Configure(PairIter begin, PairIter end)
set configuration from pair iterators.
Definition: gbm.h:158
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 ~GradientBooster()=default
virtual destructor
virtual void PredictContribution(DMatrix *dmat, std::vector< 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) *...
Definition: host_device_vector.h:200
virtual void PredictInteractionContributions(DMatrix *dmat, std::vector< bst_float > *out_contribs, unsigned ntree_limit, bool approximate)=0
The input data structure of xgboost.
static GradientBooster * Create(const std::string &name, const std::vector< std::shared_ptr< DMatrix > > &cache_mats, bst_float base_margin)
create a gradient booster from given name
Internal data structured used by XGBoost during training. There are two ways to create a customized D...
Definition: data.h:406
Feature map data structure to help text model dump. TODO(tqchen) consider make it even more lightweig...
Definition: feature_map.h:20
span class implementation, based on ISO++20 span<T>. The interface should be the same.
Definition: span.h:109
Registry entry for tree updater.
Definition: gbm.h:166
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:61
interface of objective function used by xgboost.
virtual void PredictLeaf(DMatrix *dmat, std::vector< 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 Load(dmlc::Stream *fi)=0
load model from stream
interface of objective function
Definition: objective.h:23
Feature map data structure to help visualization and model dump.
namespace of xgboost
Definition: base.h:79
defines configuration macros of xgboost.
virtual void Save(dmlc::Stream *fo) const =0
save model to stream.
virtual void DoBoost(DMatrix *p_fmat, HostDeviceVector< GradientPair > *in_gpair, ObjFunction *obj=nullptr)=0
perform update to the model(boosting)
virtual void PredictBatch(DMatrix *dmat, HostDeviceVector< bst_float > *out_preds, unsigned ntree_limit=0)=0
generate predictions for given feature matrix
interface of gradient boosting model.
Definition: gbm.h:27