xgboost
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
xgboost Namespace Reference

Core data structure for multi-target trees. More...

Namespaces

 collective
 
 common
 
 detail
 
 gbm
 
 linalg
 
 system
 
 tree
 

Classes

class  GradientPairInt64
 Fixed point representation for high precision gradient pair. Has a different interface so we don't accidentally use it in gain calculations. More...
 
class  DMatrixCache
 Thread-aware FIFO cache for DMatrix related data. More...
 
struct  DeviceSym
 
struct  DeviceOrd
 A type for device ordinal. The type is packed into 32-bit for efficient use in viewing types like linalg::TensorView. More...
 
struct  Context
 Runtime context for XGBoost. Contains information like threads and device. More...
 
class  MetaInfo
 Meta information about dataset, always sit in memory. More...
 
struct  Entry
 Element from a sparse vector. More...
 
struct  BatchParam
 Parameters for constructing histogram index batches. More...
 
struct  HostSparsePageView
 
class  SparsePage
 In-memory storage unit of sparse batch, stored in CSR format. More...
 
class  CSCPage
 
class  ExtSparsePage
 Sparse page for exporting DMatrix. Same as SparsePage, just a different type to prevent being used internally. More...
 
class  SortedCSCPage
 
class  BatchIteratorImpl
 
class  BatchIterator
 
class  BatchSet
 
class  DMatrix
 Internal data structured used by XGBoost during training. More...
 
class  FeatureMap
 Feature map data structure to help text model dump. TODO(tqchen) consider make it even more lightweight. More...
 
class  GradientBooster
 interface of gradient boosting model. More...
 
struct  GradientBoosterReg
 Registry entry for tree updater. More...
 
struct  GlobalConfiguration
 
struct  HostDeviceVectorImpl
 
class  HostDeviceVector
 
class  IntrusivePtrCell
 Helper class for embedding reference counting into client objects. See https://www.boost.org/doc/libs/1_74_0/doc/html/atomic/usage_examples.html for discussions of memory order. More...
 
class  IntrusivePtr
 Implementation of Intrusive Pointer. A smart pointer that points to an object with an embedded reference counter. The underlying object must implement a friend function IntrusivePtrRefCount() that returns the ref counter (of type IntrusivePtrCell). The intrusive pointer is faster than std::shared_ptr<>: std::shared_ptr<> makes an extra memory allocation for the ref counter whereas the intrusive pointer does not. More...
 
class  Value
 
class  JsonString
 
class  JsonArray
 
class  JsonTypedArray
 Typed array for Universal Binary JSON. More...
 
class  JsonObject
 
class  JsonNumber
 
class  JsonInteger
 
class  JsonNull
 
class  JsonBoolean
 Describes both true and false. More...
 
class  Json
 Data structure representing JSON format. More...
 
class  JsonReader
 A json reader, currently error checking and utf-8 is not fully supported. More...
 
class  JsonWriter
 
class  UBJReader
 Reader for UBJSON https://ubjson.org/. More...
 
class  UBJWriter
 Writer for UBJSON https://ubjson.org/. More...
 
class  Learner
 Learner class that does training and prediction. This is the user facing module of xgboost training. The Load/Save function corresponds to the model used in python/R. More...
 
struct  LearnerModelParam
 Basic model parameters, used to describe the booster. More...
 
class  LinearUpdater
 interface of linear updater More...
 
struct  LinearUpdaterReg
 Registry entry for linear updater. More...
 
class  Metric
 interface of evaluation metric used to evaluate model performance. This has nothing to do with training, but merely act as evaluation purpose. More...
 
struct  MetricReg
 Registry entry for Metric factory functions. The additional parameter const char* param gives the value after @, can be null. For example, metric map@3, then: param == "3". More...
 
struct  Model
 
struct  Configurable
 
class  MultiTargetTree
 Tree structure for multi-target model. More...
 
class  ObjFunction
 interface of objective function More...
 
struct  ObjFunctionReg
 Registry entry for objective factory functions. More...
 
struct  XGBoostParameter
 
struct  PredictionCacheEntry
 Contains pointer to input matrix and associated cached predictions. More...
 
class  PredictionContainer
 A container for managed prediction caches. More...
 
class  Predictor
 Performs prediction on individual training instances or batches of instances for GBTree. Prediction functions all take a GBTreeModel and a DMatrix as input and output a vector of predictions. The predictor does not modify any state of the model itself. More...
 
struct  PredictorReg
 Registry entry for predictor. More...
 
struct  StringView
 
struct  ObjInfo
 A struct returned by objective, which determines task at hand. The struct is not used by any algorithm yet, only for future development like categorical split. More...
 
struct  TreeParam
 meta parameters of the tree More...
 
struct  RTreeNodeStat
 node statistics used in regression tree More...
 
class  CopyUniquePtr
 Helper for defining copyable data structure that contains unique pointers. More...
 
class  RegTree
 define regression tree to be the most common tree model. More...
 
class  TreeUpdater
 interface of tree update module, that performs update of a tree. More...
 
struct  TreeUpdaterReg
 Registry entry for tree updater. More...
 

Typedefs

using bst_uint = std::uint32_t
 unsigned integer type used for feature index. More...
 
using bst_ulong = std::uint64_t
 unsigned long integers More...
 
using bst_float = float
 float type, used for storing statistics More...
 
using bst_cat_t = std::int32_t
 Categorical value type. More...
 
using bst_feature_t = std::uint32_t
 Type for data column (feature) index. More...
 
using bst_bin_t = std::int32_t
 Type for histogram bin index. We sometimes use -1 to indicate invalid bin. More...
 
using bst_idx_t = std::uint64_t
 Type for data row index (sample). More...
 
using bst_node_t = std::int32_t
 Type for tree node index. More...
 
using bst_group_t = std::uint32_t
 Type for ranking group index. More...
 
using bst_target_t = std::uint32_t
 Type for indexing into output targets. More...
 
using bst_layer_t = std::int32_t
 Type for indexing boosted layers. More...
 
using bst_tree_t = std::int32_t
 Type for indexing trees. More...
 
using bst_d_ordinal_t = std::int16_t
 Ordinal of a CUDA device. More...
 
using GradientPair = detail::GradientPairInternal< float >
 gradient statistics pair usually needed in gradient boosting More...
 
using GradientPairPrecise = detail::GradientPairInternal< double >
 High precision gradient statistics pair. More...
 
using Args = std::vector< std::pair< std::string, std::string > >
 
using omp_ulong = dmlc::omp_ulong
 define unsigned long for openmp loop More...
 
using bst_omp_uint = dmlc::omp_uint
 define unsigned int for openmp loop More...
 
using XGBoostVersionT = std::int32_t
 Type used for representing version number in binary form. More...
 
using GlobalConfigThreadLocalStore = dmlc::ThreadLocalStore< GlobalConfiguration >
 
using F32Array = JsonTypedArray< float, Value::ValueKind::kF32Array >
 Typed UBJSON array for 32-bit floating point. More...
 
using F64Array = JsonTypedArray< double, Value::ValueKind::kF64Array >
 Typed UBJSON array for 64-bit floating point. More...
 
using U8Array = JsonTypedArray< std::uint8_t, Value::ValueKind::kU8Array >
 Typed UBJSON array for uint8_t. More...
 
using I32Array = JsonTypedArray< std::int32_t, Value::ValueKind::kI32Array >
 Typed UBJSON array for int32_t. More...
 
using I64Array = JsonTypedArray< std::int64_t, Value::ValueKind::kI64Array >
 Typed UBJSON array for int64_t. More...
 
using Object = JsonObject
 
using Array = JsonArray
 
using Number = JsonNumber
 
using Integer = JsonInteger
 
using Boolean = JsonBoolean
 
using String = JsonString
 
using Null = JsonNull
 

Enumerations

enum class  DataType : uint8_t {
  kFloat32 = 1 , kDouble = 2 , kUInt32 = 3 , kUInt64 = 4 ,
  kStr = 5
}
 data type accepted by xgboost interface More...
 
enum class  FeatureType : uint8_t { kNumerical = 0 , kCategorical = 1 }
 
enum class  DataSplitMode : int { kRow = 0 , kCol = 1 }
 
enum  GPUAccess { kNone , kRead , kWrite }
 Controls data access from the GPU. More...
 
enum class  PredictionType : std::uint8_t {
  kValue = 0 , kMargin = 1 , kContribution = 2 , kApproxContribution = 3 ,
  kInteraction = 4 , kApproxInteraction = 5 , kLeaf = 6
}
 
enum class  MultiStrategy : std::int32_t { kOneOutputPerTree = 0 , kMultiOutputTree = 1 }
 Strategy for building multi-target models. More...
 

Functions

std::ostream & operator<< (std::ostream &os, DeviceOrd ord)
 
template<typename T >
IntrusivePtrCellIntrusivePtrRefCount (T const *ptr) noexcept
 User defined function for returning embedded reference count. More...
 
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)
 Check whether a Json object has specific type. More...
 
template<typename T , typename U >
auto get (U &json) -> decltype(detail::GetImpl(*Cast< T >(&json.GetValue())))&
 Get Json value. More...
 
template<typename Parameter >
Object ToJson (Parameter const &param)
 Convert XGBoost parameter to JSON object. More...
 
template<typename Parameter >
Args FromJson (Json const &obj, Parameter *param)
 Load a XGBoost parameter from a JSON object. More...
 
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 ()
 

Variables

constexpr bst_float kRtEps = 1e-6f
 small eps gap for minimum split decision. More...
 

Detailed Description

Core data structure for multi-target trees.

Copyright 2023 by XGBoost contributors

Copyright 2019-2024, XGBoost Contributors

Copyright 2019-2023, XGBoost Contributors

Copyright 2021-2023, XGBoost Contributors

Copyright 2021-2022 by XGBoost Contributors

Typedef Documentation

◆ 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

Type for histogram bin index. We sometimes use -1 to indicate invalid bin.

◆ bst_cat_t

using xgboost::bst_cat_t = typedef std::int32_t

Categorical value type.

◆ bst_d_ordinal_t

using xgboost::bst_d_ordinal_t = typedef std::int16_t

Ordinal of a CUDA device.

◆ bst_feature_t

using xgboost::bst_feature_t = typedef std::uint32_t

Type for data column (feature) index.

◆ bst_float

using xgboost::bst_float = typedef float

float type, used for storing statistics

◆ bst_group_t

using xgboost::bst_group_t = typedef std::uint32_t

Type for ranking group index.

◆ bst_idx_t

using xgboost::bst_idx_t = typedef std::uint64_t

Type for data row index (sample).

◆ bst_layer_t

using xgboost::bst_layer_t = typedef std::int32_t

Type for indexing boosted layers.

◆ bst_node_t

using xgboost::bst_node_t = typedef std::int32_t

Type for tree node index.

◆ bst_omp_uint

using xgboost::bst_omp_uint = typedef dmlc::omp_uint

define unsigned int for openmp loop

◆ bst_target_t

using xgboost::bst_target_t = typedef std::uint32_t

Type for indexing into output targets.

◆ bst_tree_t

using xgboost::bst_tree_t = typedef std::int32_t

Type for indexing trees.

◆ bst_uint

using xgboost::bst_uint = typedef std::uint32_t

unsigned integer type used for feature index.

◆ bst_ulong

using xgboost::bst_ulong = typedef std::uint64_t

unsigned long integers

◆ F32Array

Typed UBJSON array for 32-bit floating point.

◆ F64Array

Typed UBJSON array for 64-bit floating point.

◆ GlobalConfigThreadLocalStore

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

◆ GradientPair

gradient statistics pair usually needed in gradient boosting

◆ GradientPairPrecise

High precision gradient statistics pair.

◆ I32Array

Typed UBJSON array for int32_t.

◆ I64Array

Typed UBJSON array for int64_t.

◆ 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

define unsigned long for openmp loop

◆ String

using xgboost::String = typedef JsonString

◆ U8Array

Typed UBJSON array for uint8_t.

◆ XGBoostVersionT

using xgboost::XGBoostVersionT = typedef std::int32_t

Type used for representing version number in binary form.

Enumeration Type Documentation

◆ DataSplitMode

enum xgboost::DataSplitMode : int
strong
Enumerator
kRow 
kCol 

◆ DataType

enum xgboost::DataType : uint8_t
strong

data type accepted by xgboost interface

Enumerator
kFloat32 
kDouble 
kUInt32 
kUInt64 
kStr 

◆ FeatureType

enum xgboost::FeatureType : uint8_t
strong
Enumerator
kNumerical 
kCategorical 

◆ GPUAccess

Controls data access from the GPU.

Since a HostDeviceVector can have data on both the host and device, access control needs to be maintained to keep the data consistent.

There are 3 scenarios supported:

  • Data is being manipulated on device. GPU has write access, host doesn't have access.
  • Data is read-only on both the host and device.
  • Data is being manipulated on the host. Host has write access, device doesn't have access.
Enumerator
kNone 
kRead 
kWrite 

◆ MultiStrategy

enum xgboost::MultiStrategy : std::int32_t
strong

Strategy for building multi-target models.

Enumerator
kOneOutputPerTree 
kMultiOutputTree 

◆ PredictionType

enum xgboost::PredictionType : std::uint8_t
strong
Enumerator
kValue 
kMargin 
kContribution 
kApproxContribution 
kInteraction 
kApproxInteraction 
kLeaf 

Function Documentation

◆ 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 
)

Load a XGBoost parameter from a JSON object.

Template Parameters
ParameterAn instantiation of XGBoostParameter
Parameters
objJSON object representing the parameter.
paramOutput parameter.
Returns
Unknown arguments in the JSON object.

◆ get()

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

Get Json value.

Template Parameters
TOne of the Json value type.
Parameters
json
Returns
Value contained in Json object of type T.

◆ IntrusivePtrRefCount()

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

User defined function for returning embedded reference count.

◆ IsA() [1/2]

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

Check whether a Json object has specific type.

Json json {Array{}};
bool is_array = IsA<Array>(json);
CHECK(is_array);
JsonArray Array
Definition: json.h:615

◆ 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)

Convert XGBoost parameter to JSON object.

Template Parameters
ParameterAn instantiation of XGBoostParameter
Parameters
paramInput parameter
Returns
JSON object representing the input parameter

Variable Documentation

◆ kRtEps

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

small eps gap for minimum split decision.