xgboost
命名空间 | | 类型定义 | 枚举 | 函数 | 变量
xgboost 命名空间参考

Learner 接口,它将目标、gbm 和评估集成在一起。这是面向用户的 XGBoost 训练模块。更多...

命名空间

 collective
 
 common
 
 详细信息
 
 gbm
 
 linalg
 
 系统
 
 
 

类  GradientPairInt64
 用于高精度梯度对的定点表示。具有不同的接口,因此我们不会在增益计算中意外使用它。更多...
 
类  DMatrixCache
 DMatrix 相关数据的线程感知 FIFO 缓存。更多...
 
结构  DeviceSym
 
结构  DeviceOrd
 设备序号的类型。该类型被打包成 32 位,以便在查看像 linalg::TensorView 这样的类型时高效使用。 更多...
 
结构  Context
 XGBoost 的运行时上下文。包含线程和设备等信息。 更多...
 
类  MetaInfo
 关于数据集的元信息,始终驻留在内存中。 更多...
 
结构  Entry
 稀疏向量中的元素。 更多...
 
结构  BatchParam
 用于构建直方图索引批次的参数。 更多...
 
结构  HostSparsePageView
 
类  SparsePage
 稀疏批次的内存存储单元,以 CSR 格式存储。 更多...
 
类  CSCPage
 
类  ExtSparsePage
 用于导出 DMatrix 的稀疏页面。与 SparsePage 相同,只是类型不同,以防止在内部使用。 更多...
 
类  SortedCSCPage
 
类  BatchIteratorImpl
 
类  BatchIterator
 
类  BatchSet
 
结构  ExtMemConfig
 
类  DMatrix
 XGBoost 内部使用的数据结构,用于保存所有外部数据。更多...
 
类  特征映射 (FeatureMap)
 特征映射数据结构,用于帮助文本模型转储。TODO(tqchen) 考虑使其更加轻量化。更多...
 
类  GradientBooster
 梯度提升模型的接口。 更多...
 
结构  GradientBoosterReg
 树更新器的注册表条目。 更多...
 
结构  GlobalConfiguration
 
结构  InitNewThread
 
结构  HostDeviceVectorImpl
 
类  HostDeviceVector
 
类  IntrusivePtrCell
 用于将引用计数嵌入客户端对象的辅助类。有关内存顺序的讨论,请参阅 https://boost.ac.cn/doc/libs/1_74_0/doc/html/atomic/usage_examples.html更多...
 
类  IntrusivePtr
 侵入式指针的实现。一个智能指针,指向一个嵌入了引用计数器的对象。底层对象必须实现一个友元函数IntrusivePtrRefCount(),该函数返回引用计数器(类型为IntrusivePtrCell)。侵入式指针比std::shared_ptr<>更快:std::shared_ptr<>为引用计数器进行了额外的内存分配,而侵入式指针则没有。更多...
 
类  
 
类  JsonString
 
类  JsonArray
 
类  JsonTypedArray
 用于通用二进制 JSON 的类型化数组。更多...
 
类  JsonObject
 
类  JsonNumber
 
类  JsonInteger
 
类  JsonNull
 
类  JsonBoolean
 描述真和假。更多...
 
类  Json
 表示 JSON 格式的数据结构。更多...
 
类  JsonReader
 一个 JSON 读取器,目前错误检查和 UTF-8 尚未完全支持。更多...
 
类  JsonWriter
 
类  UBJReader
 UBJSON 的读取器 https://ubjson.org/更多...
 
类  UBJWriter
 UBJSON 的写入器 https://ubjson.org/更多...
 
类  学习器
 Learner 类,用于执行训练和预测。这是xgboost训练的用户界面模块。Load/Save 函数对应于 Python/R 中使用的模型。更多...
 
结构  LearnerModelParam
 基本的模型参数,用于描述助推器。更多...
 
类  LinearUpdater
 线性更新器的接口 更多...
 
结构  LinearUpdaterReg
 线性更新器的注册条目。 更多...
 
类  Metric
 用于评估模型性能的评估指标接口。这与训练无关,仅用于评估目的。更多...
 
结构  MetricReg
 用于 Metric 工厂函数的注册表条目。附加参数 const char* param 给出 @ 后的值,可以为 null。例如,metric map@3,则:param == "3"。 更多...
 
结构  模型
 
结构  可配置
 
结构  MultiTargetTreeView
 适用于主机和设备的 @MultiTargetTree 的视图。 更多...
 
类  MultiTargetTree
 多目标模型的树结构。更多...
 
类  ObjFunction
 目标函数的接口。 更多...
 
结构  ObjFunctionReg
 目标工厂函数的注册表条目。 更多...
 
结构  XGBoostParameter
 
结构  PredictionCacheEntry
 包含指向输入矩阵和关联的缓存预测的指针。更多...
 
类  PredictionContainer
 用于管理预测缓存的容器。更多...
 
类  预测器
 对 GBTree 的单个训练实例或批量实例执行预测。所有预测函数都将 GBTreeModel 和 DMatrix 作为输入,并输出预测向量。预测器不修改模型本身的任何状态。更多...
 
结构  PredictorReg
 预测器注册表条目。更多...
 
结构  StringView
 
结构  ObjInfo
 由目标函数返回的一个结构体,用于确定当前任务。该结构体尚未被任何算法使用,仅用于未来开发,例如分类拆分。更多信息...
 
结构  TreeParam
 树的元参数。更多...
 
结构  RTreeNodeStat
 回归树中使用的节点统计信息。更多...
 
类  CopyUniquePtr
 用于定义包含唯一指针的可复制数据结构的助手。更多...
 
类  RegTree
 定义回归树为最常见的树模型。更多...
 
类  TreeUpdater
 树更新模块的接口,用于执行树的更新。更多...
 
结构  TreeUpdaterReg
 树更新器注册表条目。更多...
 

类型定义

使用 bst_uint = std::uint32_t
 用于特征索引的无符号整数类型。更多...
 
使用 bst_ulong = std::uint64_t
 无符号长整数。更多...
 
使用 bst_float = float
 浮点类型,用于存储统计信息。更多...
 
使用 bst_cat_t = std::int32_t
 分类值类型。更多...
 
使用 bst_feature_t = std::uint32_t
 数据列(特征)索引的类型。更多...
 
使用 bst_bin_t = std::int32_t
 直方图 bin 索引的类型。我们有时使用 -1 表示无效 bin。更多...
 
使用 bst_idx_t = std::uint64_t
 数据行索引(样本)的类型。更多...
 
使用 bst_node_t = std::int32_t
 树节点索引的类型。更多...
 
使用 bst_group_t = std::uint32_t
 排名组索引的类型。更多...
 
使用 bst_target_t = std::uint32_t
 用于索引输出目标的类型。更多...
 
使用 bst_layer_t = std::int32_t
 用于索引增强层的类型。更多...
 
使用 bst_tree_t = std::int32_t
 用于索引树的类型。更多...
 
使用 bst_d_ordinal_t = std::int16_t
 CUDA 设备的序号。更多...
 
使用 GradientPair = detail::GradientPairInternal< float >
 梯度提升中通常需要的梯度统计对。更多...
 
使用 GradientPairPrecise = detail::GradientPairInternal< double >
 高精度梯度统计对。更多...
 
使用 Args = std::vector< std::pair< std::string, std::string > >
 
使用 omp_ulong = dmlc::omp_ulong
 为 openmp 循环定义无符号长整型。更多...
 
使用 bst_omp_uint = dmlc::omp_uint
 为 openmp 循环定义无符号整型。更多...
 
使用 XGBoostVersionT = std::int32_t
 用于表示二进制形式的版本号的类型。更多...
 
使用 GlobalConfigThreadLocalStore = dmlc::ThreadLocalStore< GlobalConfiguration >
 
使用 F32Array = JsonTypedArray< float, Value::ValueKind::kF32Array >
 用于 32 位浮点数的类型化 UBJSON 数组。更多...
 
使用 F64Array = JsonTypedArray< double, Value::ValueKind::kF64Array >
 用于 64 位浮点数的类型化 UBJSON 数组。更多...
 
使用 I8Array = JsonTypedArray< std::int8_t, Value::ValueKind::kI8Array >
 用于 int8_t 的类型化 UBJSON 数组。更多...
 
使用 U8Array = JsonTypedArray< std::uint8_t, Value::ValueKind::kU8Array >
 用于 uint8_t 的类型化 UBJSON 数组。更多...
 
使用 I16Array = JsonTypedArray< std::int16_t, Value::ValueKind::kI16Array >
 用于 int16_t 的类型化 UBJSON 数组。更多...
 
使用 U16Array = JsonTypedArray< std::uint16_t, Value::ValueKind::kU16Array >
 用于 uint16_t 的类型化 UBJSON 数组。更多...
 
使用 I32Array = JsonTypedArray< std::int32_t, Value::ValueKind::kI32Array >
 用于 int32_t 的类型化 UBJSON 数组。更多...
 
使用 U32Array = JsonTypedArray< std::uint32_t, Value::ValueKind::kU32Array >
 用于 uint32_t 的类型化 UBJSON 数组。更多...
 
使用 I64Array = JsonTypedArray< std::int64_t, Value::ValueKind::kI64Array >
 用于 int64_t 的类型化 UBJSON 数组。更多...
 
使用 U64Array = JsonTypedArray< std::uint64_t, Value::ValueKind::kU64Array >
 用于 uint64_t 的类型化 UBJSON 数组。更多...
 
使用 Object = JsonObject
 
使用 Array = JsonArray
 
使用 Number = JsonNumber
 
使用 Integer = JsonInteger
 
使用 Boolean = JsonBoolean
 
使用 String = JsonString
 
使用 Null = JsonNull
 

枚举

枚举类  DataType : uint8_t {
  kFloat32 = 1 , kDouble = 2 , kUInt32 = 3 , kUInt64 = 4 ,
  kStr = 5
}
 xgboost 接口接受的数据类型。更多...
 
枚举类  FeatureType : uint8_t { kNumerical = 0 , kCategorical = 1 }
 
枚举类  DataSplitMode : int { kRow = 0 , kCol = 1 }
 
枚举  GPUAccess { kNone , kRead , kWrite }
 控制从 GPU 访问数据。更多...
 
枚举类  PredictionType : std::uint8_t {
  kValue = 0 , kMargin = 1 , kContribution = 2 , kApproxContribution = 3 ,
  kInteraction = 4 , kApproxInteraction = 5 , kLeaf = 6
}
 
枚举类  MultiStrategy : std::int32_t { kOneOutputPerTree = 0 , kMultiOutputTree = 1 }
 构建多目标模型的策略。更多...
 

函数

std::ostream & operator<< (std::ostream &os, DeviceOrd ord)
 
template<typename T >
IntrusivePtrCellIntrusivePtrRefCount (T const *ptr) noexcept
 用于返回嵌入式引用计数的用户定义函数。更多...
 
template<class T , class U >
bool operator== (IntrusivePtr< T > const &x, IntrusivePtr< U > const &y) noexcept
 
template<class T , class U >
bool operator!= (IntrusivePtr< T > const &x, IntrusivePtr< U > const &y) noexcept
 
template<class T , class U >
bool operator== (IntrusivePtr< T > const &x, U *y) noexcept
 
template<class T , class U >
bool operator!= (IntrusivePtr< T > const &x, U *y) noexcept
 
template<class T , class U >
bool operator== (T *x, IntrusivePtr< U > const &y) noexcept
 
template<class T , class U >
bool operator!= (T *x, IntrusivePtr< U > const &y) noexcept
 
template<class T >
bool operator< (IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
 
template<class T >
bool operator<= (IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
 
template<class T >
bool operator> (IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
 
template<class T >
bool operator>= (IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
 
template<class E , class T , class Y >
std::basic_ostream< E, T > & operator<< (std::basic_ostream< E, T > &os, IntrusivePtr< Y > const &p)
 
template<typename T >
bool IsA (Value const *value)
 
template<typename T , typename U >
T * Cast (U *value)
 
template<typename T >
bool IsA (Json const &j)
 检查 Json 对象是否具有特定类型。更多...
 
template<typename T , typename U >
auto get (U &json) -> decltype(detail::GetImpl(*Cast< T >(&json.GetValue())))&
 获取 Json 值。更多...
 
template<typename Parameter >
Object ToJson (Parameter const &param)
 将 XGBoost 参数转换为 JSON 对象。更多...
 
template<typename Parameter >
Args FromJson (Json const &obj, Parameter *param)
 从 JSON 对象加载 XGBoost 参数。更多...
 
template<typename T >
BuiltinBSwap (T v)
 
template<typename T , std::enable_if_t< sizeof(T)==1 > * = nullptr>
ToBigEndian (T v)
 
std::ostream & operator<< (std::ostream &os, StringView const v)
 
bool operator== (StringView l, StringView r)
 
bool operator!= (StringView l, StringView r)
 
bool operator< (StringView l, StringView r)
 
bool operator< (std::string const &l, StringView r)
 
bool operator< (StringView l, std::string const &r)
 
StringView MTNotImplemented ()
 

变量

constexpr bst_float kRtEps = 1e-6f
 最小分割决策的小 eps 间隙。更多...
 

详细描述

Learner 接口,将目标、gbm 和评估整合在一起。这是用户界面 XGBoost 训练模块。

树的模型结构

xgboost 使用的目标函数接口。

多目标树的核心数据结构。

Copyright 2023 by XGBoost contributors

Copyright 2019-2025, XGBoost Contributors

Copyright 2019-2024, XGBoost Contributors

版权所有 2015-2025, XGBoost 贡献者

作者
陈天奇

Copyright 2023-2025, XGBoost contributors

Copyright 2014-2025, XGBoost Contributors

作者
陈天奇,陈凯龙

Copyright 2021-2023, XGBoost Contributors

Copyright 2021-2024, XGBoost Contributors

Copyright 2014-2025, XGBoost Contributors

作者
陈天奇

类型定义文档

◆ Args

using xgboost::Args = typedef std::vector<std::pair<std::string, std::string> >

◆ Array

using xgboost::Array = typedef JsonArray

◆ Boolean

using xgboost::Boolean = typedef JsonBoolean

◆ bst_bin_t

using xgboost::bst_bin_t = typedef std::int32_t

直方图 bin 索引的类型。我们有时使用 -1 表示无效 bin。

◆ bst_cat_t

using xgboost::bst_cat_t = typedef std::int32_t

分类值类型。

◆ bst_d_ordinal_t

using xgboost::bst_d_ordinal_t = typedef std::int16_t

CUDA 设备的序号。

◆ bst_feature_t

using xgboost::bst_feature_t = typedef std::uint32_t

数据列(特征)索引的类型。

◆ bst_float

using xgboost::bst_float = typedef float

浮点类型,用于存储统计信息

◆ bst_group_t

using xgboost::bst_group_t = typedef std::uint32_t

排名组索引的类型。

◆ bst_idx_t

using xgboost::bst_idx_t = typedef std::uint64_t

数据行索引(样本)的类型。

◆ bst_layer_t

using xgboost::bst_layer_t = typedef std::int32_t

用于索引提升层的类型。

◆ bst_node_t

using xgboost::bst_node_t = typedef std::int32_t

树节点索引的类型。

◆ bst_omp_uint

using xgboost::bst_omp_uint = typedef dmlc::omp_uint

为 openmp 循环定义无符号整型

◆ bst_target_t

using xgboost::bst_target_t = typedef std::uint32_t

用于索引输出目标的类型。

◆ bst_tree_t

using xgboost::bst_tree_t = typedef std::int32_t

用于索引树的类型。

◆ bst_uint

using xgboost::bst_uint = typedef std::uint32_t

用于特征索引的无符号整数类型。

◆ bst_ulong

using xgboost::bst_ulong = typedef std::uint64_t

无符号长整数

◆ F32Array

用于 32 位浮点数的类型化 UBJSON 数组。

◆ F64Array

用于 64 位浮点数的类型化 UBJSON 数组。

◆ GlobalConfigThreadLocalStore

using xgboost::GlobalConfigThreadLocalStore = typedef dmlc::ThreadLocalStore<GlobalConfiguration>

◆ GradientPair

梯度提升中通常需要的梯度统计对

◆ GradientPairPrecise

高精度梯度统计对。

◆ I16Array

用于 int16_t 的类型化 UBJSON 数组。

◆ I32Array

用于 int32_t 的类型化 UBJSON 数组。

◆ I64Array

用于 int64_t 的类型化 UBJSON 数组。

◆ I8Array

用于 int8_t 的类型化 UBJSON 数组。

◆ Integer

using xgboost::Integer = typedef JsonInteger

◆ Null

using xgboost::Null = typedef JsonNull

◆ Number

using xgboost::Number = typedef JsonNumber

◆ Object

using xgboost::Object = typedef JsonObject

◆ omp_ulong

using xgboost::omp_ulong = typedef dmlc::omp_ulong

为 openmp 循环定义无符号长整型

◆ String

using xgboost::String = typedef JsonString

◆ U16Array

用于 uint16_t 的类型化 UBJSON 数组。

◆ U32Array

用于 uint32_t 的类型化 UBJSON 数组。

◆ U64Array

用于 uint64_t 的类型化 UBJSON 数组。

◆ U8Array

用于 uint8_t 的类型化 UBJSON 数组。

◆ XGBoostVersionT

using xgboost::XGBoostVersionT = typedef std::int32_t

用于表示二进制形式的版本号的类型。

枚举类型文档

◆ DataSplitMode

enum xgboost::DataSplitMode : int
枚举器
kRow 
kCol 

◆ DataType

enum xgboost::DataType : uint8_t

xgboost接口接受的数据类型

枚举器
kFloat32 
kDouble 
kUInt32 
kUInt64 
kStr 

◆ FeatureType

enum xgboost::FeatureType : uint8_t
枚举器
kNumerical 
kCategorical 

◆ GPUAccess

控制从 GPU 访问数据。

由于 HostDeviceVector 可以同时在主机和设备上拥有数据,因此需要维护访问控制以保持数据一致。

支持 3 种场景

  • 数据正在设备上操作。GPU 具有写访问权限,主机没有访问权限。
  • 数据在主机和设备上都是只读的。
  • 数据正在主机上操作。主机具有写访问权限,设备没有访问权限。
枚举器
kNone 
kRead 
kWrite 

◆ MultiStrategy

enum xgboost::MultiStrategy : std::int32_t

构建多目标模型的策略。

枚举器
kOneOutputPerTree 
kMultiOutputTree 

◆ PredictionType

enum xgboost::PredictionType : std::uint8_t
枚举器
kValue 
kMargin 
kContribution 
kApproxContribution 
kInteraction 
kApproxInteraction 
kLeaf 

函数文档

◆ BuiltinBSwap()

template<typename T >
T xgboost::BuiltinBSwap ( v)

◆ Cast()

template<typename T , typename U >
T* xgboost::Cast ( U *  value)

◆ FromJson()

template<typename Parameter >
Args xgboost::FromJson ( Json const &  obj,
Parameter *  param 
)

从 JSON 对象加载 XGBoost 参数。

模板参数
参数XGBoostParameter 的实例化
参数
obj表示参数的 JSON 对象。
param输出参数。
返回
JSON 对象中未知的参数。

◆ get()

template<typename T , typename U >
auto xgboost::get ( U &  json) -> decltype(detail::GetImpl(*Cast<T>(&json.GetValue())))&

获取 Json 值。

模板参数
TJson 值类型之一。
参数
json
返回
类型 T 的 Json 对象中包含的 Value

◆ IntrusivePtrRefCount()

template<typename T >
IntrusivePtrCell& xgboost::IntrusivePtrRefCount ( T const *  ptr)
noexcept

用于返回嵌入式引用计数的自定义函数。

◆ IsA() [1/2]

template<typename T >
bool xgboost::IsA ( Json const &  j)

检查 Json 对象是否具有特定类型。

Json json {Array{}};
bool is_array = IsA<Array>(json);
CHECK(is_array);
JsonArray 数组
定义: json.h:619

◆ IsA() [2/2]

template<typename T >
bool xgboost::IsA ( Value const *  value)

◆ MTNotImplemented()

StringView xgboost::MTNotImplemented ( )
inline

◆ operator!=() [1/4]

template<class T , class U >
bool xgboost::operator!= ( IntrusivePtr< T > const &  x,
IntrusivePtr< U > const &  y 
)
noexcept

◆ operator!=() [2/4]

template<class T , class U >
bool xgboost::operator!= ( IntrusivePtr< T > const &  x,
U *  y 
)
noexcept

◆ operator!=() [3/4]

bool xgboost::operator!= ( StringView  l,
StringView  r 
)
inline

◆ operator!=() [4/4]

template<class T , class U >
bool xgboost::operator!= ( T *  x,
IntrusivePtr< U > const &  y 
)
noexcept

◆ operator<() [1/4]

template<class T >
bool xgboost::operator< ( IntrusivePtr< T > const &  x,
IntrusivePtr< T > const &  y 
)
noexcept

◆ operator<() [2/4]

bool xgboost::operator< ( std::string const &  l,
StringView  r 
)
inline

◆ operator<() [3/4]

bool xgboost::operator< ( StringView  l,
std::string const &  r 
)
inline

◆ operator<() [4/4]

bool xgboost::operator< ( StringView  l,
StringView  r 
)
inline

◆ operator<<() [1/3]

template<class E , class T , class Y >
std::basic_ostream<E, T>& xgboost::operator<< ( std::basic_ostream< E, T > &  os,
IntrusivePtr< Y > const &  p 
)

◆ operator<<() [2/3]

std::ostream& xgboost::operator<< ( std::ostream &  os,
DeviceOrd  ord 
)

◆ operator<<() [3/3]

std::ostream& xgboost::operator<< ( std::ostream &  os,
StringView const  v 
)
inline

◆ operator<=()

template<class T >
bool xgboost::operator<= ( IntrusivePtr< T > const &  x,
IntrusivePtr< T > const &  y 
)
noexcept

◆ operator==() [1/4]

template<class T , class U >
bool xgboost::operator== ( IntrusivePtr< T > const &  x,
IntrusivePtr< U > const &  y 
)
noexcept

◆ operator==() [2/4]

template<class T , class U >
bool xgboost::operator== ( IntrusivePtr< T > const &  x,
U *  y 
)
noexcept

◆ operator==() [3/4]

bool xgboost::operator== ( StringView  l,
StringView  r 
)
inline

◆ operator==() [4/4]

template<class T , class U >
bool xgboost::operator== ( T *  x,
IntrusivePtr< U > const &  y 
)
noexcept

◆ operator>()

template<class T >
bool xgboost::operator> ( IntrusivePtr< T > const &  x,
IntrusivePtr< T > const &  y 
)
noexcept

◆ operator>=()

template<class T >
bool xgboost::operator>= ( IntrusivePtr< T > const &  x,
IntrusivePtr< T > const &  y 
)
noexcept

◆ ToBigEndian()

template<typename T , std::enable_if_t< sizeof(T)==1 > * = nullptr>
T xgboost::ToBigEndian ( v)
inline

◆ ToJson()

template<typename Parameter >
Object xgboost::ToJson ( Parameter const &  param)

将 XGBoost 参数转换为 JSON 对象。

模板参数
参数XGBoostParameter 的实例化
参数
param输入参数
返回
表示输入参数的 JSON 对象

变量文档

◆ kRtEps

constexpr bst_float xgboost::kRtEps = 1e-6f
constexpr

最小分割决策的小 eps 间隙。