xgboost
Classes | Public Member Functions | Protected Attributes | List of all members
xgboost::common::PartitionBuilder< BlockSize > Class Template Reference

#include <partition_builder.h>

Collaboration diagram for xgboost::common::PartitionBuilder< BlockSize >:
Collaboration graph

Classes

struct  BlockInfo
 

Public Member Functions

template<typename Func >
void Init (const size_t n_tasks, size_t n_nodes, Func funcNTask)
 
template<bool default_left, bool any_missing, typename ColumnType , typename Predicate >
std::pair< size_t, size_t > PartitionKernel (const ColumnType &column, common::Span< const size_t > row_indices, common::Span< size_t > left_part, common::Span< size_t > right_part, size_t base_rowid, Predicate &&pred)
 
template<typename Pred >
std::pair< size_t, size_t > PartitionRangeKernel (common::Span< const size_t > ridx, common::Span< size_t > left_part, common::Span< size_t > right_part, Pred pred)
 
template<typename BinIdxType , bool any_missing, bool any_cat>
void Partition (const size_t node_in_set, const size_t nid, const common::Range1d range, const int32_t split_cond, GHistIndexMatrix const &gmat, const ColumnMatrix &column_matrix, const RegTree &tree, const size_t *rid)
 
template<typename Pred >
void PartitionRange (const size_t node_in_set, const size_t nid, common::Range1d range, bst_feature_t fidx, common::RowSetCollection *p_row_set_collection, Pred pred)
 Partition tree nodes with specific range of row indices. More...
 
void AllocateForTask (size_t id)
 
common::Span< size_t > GetLeftBuffer (int nid, size_t begin, size_t end)
 
common::Span< size_t > GetRightBuffer (int nid, size_t begin, size_t end)
 
void SetNLeftElems (int nid, size_t begin, size_t end, size_t n_left)
 
void SetNRightElems (int nid, size_t begin, size_t end, size_t n_right)
 
size_t GetNLeftElems (int nid) const
 
size_t GetNRightElems (int nid) const
 
void CalculateRowOffsets ()
 
void MergeToArray (int nid, size_t begin, size_t *rows_indexes)
 
size_t GetTaskIdx (int nid, size_t begin)
 

Protected Attributes

std::vector< std::pair< size_t, size_t > > left_right_nodes_sizes_
 
std::vector< size_t > blocks_offsets_
 
std::vector< std::shared_ptr< BlockInfo > > mem_blocks_
 
size_t max_n_tasks_ = 0
 

Member Function Documentation

◆ AllocateForTask()

template<size_t BlockSize>
void xgboost::common::PartitionBuilder< BlockSize >::AllocateForTask ( size_t  id)
inline

◆ CalculateRowOffsets()

template<size_t BlockSize>
void xgboost::common::PartitionBuilder< BlockSize >::CalculateRowOffsets ( )
inline

◆ GetLeftBuffer()

template<size_t BlockSize>
common::Span<size_t> xgboost::common::PartitionBuilder< BlockSize >::GetLeftBuffer ( int  nid,
size_t  begin,
size_t  end 
)
inline

◆ GetNLeftElems()

template<size_t BlockSize>
size_t xgboost::common::PartitionBuilder< BlockSize >::GetNLeftElems ( int  nid) const
inline

◆ GetNRightElems()

template<size_t BlockSize>
size_t xgboost::common::PartitionBuilder< BlockSize >::GetNRightElems ( int  nid) const
inline

◆ GetRightBuffer()

template<size_t BlockSize>
common::Span<size_t> xgboost::common::PartitionBuilder< BlockSize >::GetRightBuffer ( int  nid,
size_t  begin,
size_t  end 
)
inline

◆ GetTaskIdx()

template<size_t BlockSize>
size_t xgboost::common::PartitionBuilder< BlockSize >::GetTaskIdx ( int  nid,
size_t  begin 
)
inline

◆ Init()

template<size_t BlockSize>
template<typename Func >
void xgboost::common::PartitionBuilder< BlockSize >::Init ( const size_t  n_tasks,
size_t  n_nodes,
Func  funcNTask 
)
inline

◆ MergeToArray()

template<size_t BlockSize>
void xgboost::common::PartitionBuilder< BlockSize >::MergeToArray ( int  nid,
size_t  begin,
size_t *  rows_indexes 
)
inline

◆ Partition()

template<size_t BlockSize>
template<typename BinIdxType , bool any_missing, bool any_cat>
void xgboost::common::PartitionBuilder< BlockSize >::Partition ( const size_t  node_in_set,
const size_t  nid,
const common::Range1d  range,
const int32_t  split_cond,
GHistIndexMatrix const &  gmat,
const ColumnMatrix column_matrix,
const RegTree tree,
const size_t *  rid 
)
inline

◆ PartitionKernel()

template<size_t BlockSize>
template<bool default_left, bool any_missing, typename ColumnType , typename Predicate >
std::pair<size_t, size_t> xgboost::common::PartitionBuilder< BlockSize >::PartitionKernel ( const ColumnType column,
common::Span< const size_t >  row_indices,
common::Span< size_t >  left_part,
common::Span< size_t >  right_part,
size_t  base_rowid,
Predicate &&  pred 
)
inline

◆ PartitionRange()

template<size_t BlockSize>
template<typename Pred >
void xgboost::common::PartitionBuilder< BlockSize >::PartitionRange ( const size_t  node_in_set,
const size_t  nid,
common::Range1d  range,
bst_feature_t  fidx,
common::RowSetCollection p_row_set_collection,
Pred  pred 
)
inline

Partition tree nodes with specific range of row indices.

Template Parameters
PredPredicate for whether a row should be partitioned to the left node.
Parameters
node_in_setThe index of node in current batch of nodes.
nidThe cannonical node index (node index in the tree).
rangeThe range of input row index.
fidxFeature index.
p_row_set_collectionPointer to rows that are being partitioned.
predA callback function that returns whether current row should be partitioned to the left node, it should accept the row index as input and returns a boolean value.

◆ PartitionRangeKernel()

template<size_t BlockSize>
template<typename Pred >
std::pair<size_t, size_t> xgboost::common::PartitionBuilder< BlockSize >::PartitionRangeKernel ( common::Span< const size_t >  ridx,
common::Span< size_t >  left_part,
common::Span< size_t >  right_part,
Pred  pred 
)
inline

◆ SetNLeftElems()

template<size_t BlockSize>
void xgboost::common::PartitionBuilder< BlockSize >::SetNLeftElems ( int  nid,
size_t  begin,
size_t  end,
size_t  n_left 
)
inline

◆ SetNRightElems()

template<size_t BlockSize>
void xgboost::common::PartitionBuilder< BlockSize >::SetNRightElems ( int  nid,
size_t  begin,
size_t  end,
size_t  n_right 
)
inline

Member Data Documentation

◆ blocks_offsets_

template<size_t BlockSize>
std::vector<size_t> xgboost::common::PartitionBuilder< BlockSize >::blocks_offsets_
protected

◆ left_right_nodes_sizes_

template<size_t BlockSize>
std::vector<std::pair<size_t, size_t> > xgboost::common::PartitionBuilder< BlockSize >::left_right_nodes_sizes_
protected

◆ max_n_tasks_

template<size_t BlockSize>
size_t xgboost::common::PartitionBuilder< BlockSize >::max_n_tasks_ = 0
protected

◆ mem_blocks_

template<size_t BlockSize>
std::vector<std::shared_ptr<BlockInfo> > xgboost::common::PartitionBuilder< BlockSize >::mem_blocks_
protected

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