Medial Code Documentation
Loading...
Searching...
No Matches
init_estimation.h
1
4#ifndef XGBOOST_OBJECTIVE_INIT_ESTIMATION_H_
5#define XGBOOST_OBJECTIVE_INIT_ESTIMATION_H_
6#include "xgboost/data.h" // MetaInfo
7#include "xgboost/linalg.h" // Tensor
8#include "xgboost/objective.h" // ObjFunction
9
10namespace xgboost::obj {
11class FitIntercept : public ObjFunction {
12 void InitEstimation(MetaInfo const& info, linalg::Vector<float>* base_score) const override;
13};
14
15inline void CheckInitInputs(MetaInfo const& info) {
16 CHECK_EQ(info.labels.Shape(0), info.num_row_) << "Invalid shape of labels.";
17 if (!info.weights_.Empty()) {
18 CHECK_EQ(info.weights_.Size(), info.num_row_)
19 << "Number of weights should be equal to number of data points.";
20 }
21}
22} // namespace xgboost::obj
23#endif // XGBOOST_OBJECTIVE_INIT_ESTIMATION_H_
Meta information about dataset, always sit in memory.
Definition data.h:48
HostDeviceVector< bst_float > weights_
weights of each instance, optional
Definition data.h:69
uint64_t num_row_
number of rows in the data
Definition data.h:54
linalg::Tensor< float, 2 > labels
label of each instance
Definition data.h:60
interface of objective function
Definition objective.h:29
A tensor storage.
Definition linalg.h:742
Definition init_estimation.h:11
Copyright 2015-2023 by XGBoost Contributors.
Copyright 2021-2023 by XGBoost Contributors.
Copyright 2022-2023 by XGBoost contributors.
Definition custom_obj.cc:13
Copyright 2014-2023 by XGBoost Contributors.