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>
9 #include <xgboost/generic_parameters.h>
10 #include <xgboost/host_device_vector.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:
32 GenericParameter const* learner_param_;
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
66 struct LinearUpdaterReg
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
xgboost::HostDeviceVector
Definition: host_device_vector.h:86
data.h
The input data structure of xgboost.
xgboost::GenericParameter
Definition: generic_parameters.h:14
model.h
Defines the abstract interface for different components in XGBoost.
xgboost::DMatrix
Internal data structured used by XGBoost during training.
Definition: data.h:464
host_device_vector.h
A device-and-host vector abstraction layer.
xgboost::LinearUpdater
interface of linear updater
Definition: linear_updater.h:30
xgboost::Configurable
Definition: model.h:31
xgboost::LinearUpdaterReg
Registry entry for linear updater.
Definition: linear_updater.h:66
xgboost
namespace of xgboost
Definition: base.h:102
xgboost::LinearUpdater::learner_param_
GenericParameter const * learner_param_
Definition: linear_updater.h:32
base.h
defines configuration macros of xgboost.
generic_parameters.h