Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions
xgboost::LearnerIO Class Reference
Inheritance diagram for xgboost::LearnerIO:
xgboost::LearnerConfiguration xgboost::Learner xgboost::Model xgboost::Configurable dmlc::Serializable xgboost::LearnerImpl

Public Member Functions

 LearnerIO (std::vector< std::shared_ptr< DMatrix > > cache)
 
void LoadModel (Json const &in) override
 load the model from a JSON object
 
void SaveModel (Json *p_out) const override
 saves the model config to a JSON object
 
void LoadModel (dmlc::Stream *fi) override
 
void SaveModel (dmlc::Stream *fo) const override
 
void Save (dmlc::Stream *fo) const override
 saves the model to a stream
 
void Load (dmlc::Stream *fi) override
 load the model from a stream
 
- Public Member Functions inherited from xgboost::LearnerConfiguration
 LearnerConfiguration (std::vector< std::shared_ptr< DMatrix > > cache)
 
void Configure () override
 Configure Learner based on set parameters.
 
void CheckModelInitialized () const
 
void LoadConfig (Json const &in) override
 Load configuration from JSON object.
 
void SaveConfig (Json *p_out) const override
 Save configuration to JSON object.
 
void SetParam (const std::string &key, const std::string &value) override
 Set parameter for booster.
 
void SetParams (std::vector< std::pair< std::string, std::string > > const &args) override
 Set multiple parameters at once.
 
uint32_t GetNumFeature () const override
 Get the number of features of the booster.
 
void SetAttr (const std::string &key, const std::string &value) override
 Set additional attribute to the Booster.
 
bool GetAttr (const std::string &key, std::string *out) const override
 Get attribute from the booster. The property will be saved along the booster.
 
bool DelAttr (const std::string &key) override
 Delete an attribute from the booster.
 
void SetFeatureNames (std::vector< std::string > const &fn) override
 Set the feature names for current booster.
 
void GetFeatureNames (std::vector< std::string > *fn) const override
 Get the feature names for current booster.
 
void SetFeatureTypes (std::vector< std::string > const &ft) override
 Set the feature types for current booster.
 
void GetFeatureTypes (std::vector< std::string > *p_ft) const override
 Get the feature types for current booster.
 
std::vector< std::string > GetAttrNames () const override
 Get a vector of attribute names from the booster.
 
const std::map< std::string, std::string > & GetConfigurationArguments () const override
 Get configuration arguments currently stored by the learner.
 
Context const * Ctx () const override
 Return the context object of this Booster.
 
- Public Member Functions inherited from xgboost::Learner
 ~Learner () override
 virtual destructor
 
virtual void UpdateOneIter (int iter, std::shared_ptr< DMatrix > train)=0
 update the model for one iteration With the specified objective function.
 
virtual void BoostOneIter (int iter, std::shared_ptr< DMatrix > train, HostDeviceVector< GradientPair > *in_gpair)=0
 Do customized gradient boosting with in_gpair. in_gair can be mutated after this call.
 
virtual std::string EvalOneIter (int iter, const std::vector< std::shared_ptr< DMatrix > > &data_sets, const std::vector< std::string > &data_names)=0
 evaluate the model for specific iteration using the configured metrics.
 
virtual void Predict (std::shared_ptr< DMatrix > data, bool output_margin, HostDeviceVector< bst_float > *out_preds, bst_layer_t layer_begin, bst_layer_t layer_end, bool training=false, bool pred_leaf=false, bool pred_contribs=false, bool approx_contribs=false, bool pred_interactions=false)=0
 get prediction given the model.
 
virtual void InplacePredict (std::shared_ptr< DMatrix > p_m, PredictionType type, float missing, HostDeviceVector< float > **out_preds, bst_layer_t layer_begin, bst_layer_t layer_end)=0
 Inplace prediction.
 
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
 Calculate feature score. See doc in C API for outputs.
 
virtual int32_t BoostedRounds () const =0
 
virtual std::uint32_t Groups () const =0
 Get the number of output groups from the model.
 
virtual LearnerSlice (bst_layer_t begin, bst_layer_t end, bst_layer_t step, bool *out_of_bound)=0
 Slice the model.
 
virtual std::vector< std::string > DumpModel (const FeatureMap &fmap, bool with_stats, std::string format)=0
 dump the model in the requested format
 
virtual XGBAPIThreadLocalEntryGetThreadLocal () const =0
 
- Public Member Functions inherited from dmlc::Serializable
virtual ~Serializable ()
 virtual destructor
 

Additional Inherited Members

- Static Public Member Functions inherited from xgboost::Learner
static LearnerCreate (const std::vector< std::shared_ptr< DMatrix > > &cache_data)
 Create a new instance of learner.
 
- Protected Member Functions inherited from xgboost::LearnerConfiguration
void ConfigureModelParamWithoutBaseScore ()
 
void InitBaseScore (DMatrix const *p_fmat)
 Calculate the base_score based on input data.
 
- Protected Attributes inherited from xgboost::LearnerConfiguration
std::atomic< bool > need_configuration_
 
std::map< std::string, std::string > cfg_
 
std::map< std::string, std::string > attributes_
 
std::vector< std::string > feature_names_
 
std::vector< std::string > feature_types_
 
common::Monitor monitor_
 
LearnerModelParamLegacy mparam_
 
LearnerModelParam learner_model_param_
 
LearnerTrainParam tparam_
 
PredictionContainer prediction_container_
 
std::vector< std::string > metric_names_
 
- Protected Attributes inherited from xgboost::Learner
std::unique_ptr< ObjFunctionobj_
 objective function
 
std::unique_ptr< GradientBoostergbm_
 The gradient booster used by the model.
 
std::vector< std::unique_ptr< Metric > > metrics_
 The evaluation metrics used to evaluate the model.
 
Context ctx_
 Training parameter.
 
- Static Protected Attributes inherited from xgboost::LearnerConfiguration
static std::string const kEvalMetric {"eval_metric"}
 

Member Function Documentation

◆ Load()

void xgboost::LearnerIO::Load ( dmlc::Stream fi)
inlineoverridevirtual

load the model from a stream

Parameters
fistream where to load the model from

Implements dmlc::Serializable.

◆ LoadModel() [1/2]

void xgboost::LearnerIO::LoadModel ( dmlc::Stream fi)
inlineoverridevirtual

Implements xgboost::Learner.

◆ LoadModel() [2/2]

void xgboost::LearnerIO::LoadModel ( Json const &  in)
inlineoverridevirtual

load the model from a JSON object

Parameters
inJSON object where to load the model from

Implements xgboost::Learner.

◆ Save()

void xgboost::LearnerIO::Save ( dmlc::Stream fo) const
inlineoverridevirtual

saves the model to a stream

Parameters
fostream where to save the model to

Implements dmlc::Serializable.

◆ SaveModel() [1/2]

void xgboost::LearnerIO::SaveModel ( dmlc::Stream fo) const
inlineoverridevirtual

Implements xgboost::Learner.

◆ SaveModel() [2/2]

void xgboost::LearnerIO::SaveModel ( Json out) const
inlineoverridevirtual

saves the model config to a JSON object

Parameters
outJSON container where to save the model to

Implements xgboost::Learner.


The documentation for this class was generated from the following file: