xgboost
linear_updater.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 by Contributors
3  */
4 #pragma once
5 
6 #include <dmlc/registry.h>
7 #include <xgboost/base.h>
8 #include <xgboost/data.h>
11 #include <xgboost/model.h>
12 
13 #include <functional>
14 #include <string>
15 #include <utility>
16 #include <vector>
17 
18 
19 namespace xgboost {
20 
21 class Json;
22 
23 namespace gbm {
24 class GBLinearModel;
25 } // namespace gbm
26 
30 class LinearUpdater : public Configurable {
31  protected:
33 
34  public:
36  ~LinearUpdater() override = default;
41  virtual void Configure(
42  const std::vector<std::pair<std::string, std::string> >& args) = 0;
43 
52  virtual void Update(HostDeviceVector<GradientPair>* in_gpair, DMatrix* data,
53  gbm::GBLinearModel* model,
54  double sum_instance_weight) = 0;
55 
60  static LinearUpdater* Create(const std::string& name, GenericParameter const*);
61 };
62 
67  : public dmlc::FunctionRegEntryBase<LinearUpdaterReg,
68  std::function<LinearUpdater*()> > {};
69 
73 #define XGBOOST_REGISTER_LINEAR_UPDATER(UniqueId, Name) \
74  static DMLC_ATTRIBUTE_UNUSED ::xgboost::LinearUpdaterReg& \
75  __make_##LinearUpdaterReg##_##UniqueId##__ = \
76  ::dmlc::Registry< ::xgboost::LinearUpdaterReg>::Get()->__REGISTER__( \
77  Name)
78 
79 } // namespace xgboost
Definition: host_device_vector.h:86
The input data structure of xgboost.
Definition: generic_parameters.h:14
Defines the abstract interface for different components in XGBoost.
Internal data structured used by XGBoost during training.
Definition: data.h:464
A device-and-host vector abstraction layer.
interface of linear updater
Definition: linear_updater.h:30
Definition: model.h:31
Registry entry for linear updater.
Definition: linear_updater.h:66
namespace of xgboost
Definition: base.h:102
GenericParameter const * learner_param_
Definition: linear_updater.h:32
defines configuration macros of xgboost.