Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions
xgboost::common::ColumnSampler Class Reference

Handles selection of columns due to colsample_bytree, colsample_bylevel and colsample_bynode parameters. More...

#include <random.h>

Public Member Functions

std::shared_ptr< HostDeviceVector< bst_feature_t > > ColSample (std::shared_ptr< HostDeviceVector< bst_feature_t > > p_features, float colsample)
 
 ColumnSampler (uint32_t seed)
 Column sampler constructor.
 
 ColumnSampler ()
 Column sampler constructor.
 
void Init (Context const *ctx, int64_t num_col, std::vector< float > feature_weights, float colsample_bynode, float colsample_bylevel, float colsample_bytree)
 Initialise this object before use.
 
void Reset ()
 Resets this object.
 
std::shared_ptr< HostDeviceVector< bst_feature_t > > GetFeatureSet (int depth)
 Samples a feature set.
 

Detailed Description

Handles selection of columns due to colsample_bytree, colsample_bylevel and colsample_bynode parameters.

Should be initialised before tree construction and to reset when tree construction is completed.

Constructor & Destructor Documentation

◆ ColumnSampler() [1/2]

xgboost::common::ColumnSampler::ColumnSampler ( uint32_t  seed)
inlineexplicit

Column sampler constructor.

Note
This constructor manually sets the rng seed

◆ ColumnSampler() [2/2]

xgboost::common::ColumnSampler::ColumnSampler ( )
inline

Column sampler constructor.

Note
This constructor synchronizes the RNG seed across processes.

Member Function Documentation

◆ GetFeatureSet()

std::shared_ptr< HostDeviceVector< bst_feature_t > > xgboost::common::ColumnSampler::GetFeatureSet ( int  depth)
inline

Samples a feature set.

Parameters
depthThe tree depth of the node at which to sample.
Returns
The sampled feature set.
Note
If colsample_bynode_ < 1.0, this method creates a new feature set each time it is called. Therefore, it should be called only once per node.
With distributed xgboost, this function must be called exactly once for the construction of each tree node, and must be called the same number of times in each process and with the same parameters to return the same feature set across processes.

◆ Init()

void xgboost::common::ColumnSampler::Init ( Context const *  ctx,
int64_t  num_col,
std::vector< float >  feature_weights,
float  colsample_bynode,
float  colsample_bylevel,
float  colsample_bytree 
)
inline

Initialise this object before use.

Parameters
num_col
colsample_bynode
colsample_bylevel
colsample_bytree
skip_index_0(Optional) True to skip index 0.

The documentation for this class was generated from the following files: