Interface for ordered bin data. efficient for construct histogram, especially for sparse bin There are 2 advantages by using ordered bin.
More...
#include <bin.h>
|
virtual | ~OrderedBin () |
| virtual destructor
|
|
virtual void | Init (const char *used_indices, data_size_t num_leaves)=0 |
| Initialization logic.
|
|
virtual void | ConstructHistogram (int leaf, const score_t *gradients, const score_t *hessians, HistogramBinEntry *out) const =0 |
| Construct histogram by using this bin Note: Unlike Bin, OrderedBin doesn't use ordered gradients and ordered hessians. Because it is hard to know the relative index in one leaf for sparse bin, since we skipped zero bins.
|
|
virtual void | ConstructHistogram (int leaf, const score_t *gradients, HistogramBinEntry *out) const =0 |
| Construct histogram by using this bin Note: Unlike Bin, OrderedBin doesn't use ordered gradients and ordered hessians. Because it is hard to know the relative index in one leaf for sparse bin, since we skipped zero bins.
|
|
virtual void | Split (int leaf, int right_leaf, const char *is_in_leaf, char mark)=0 |
| Split current bin, and perform re-order by leaf.
|
|
virtual data_size_t | NonZeroCount (int leaf) const =0 |
|
Interface for ordered bin data. efficient for construct histogram, especially for sparse bin There are 2 advantages by using ordered bin.
- group the data by leafs to improve the cache hit.
- only store the non-zero bin, which can speed up the histogram consturction for sparse features. However it brings additional cost: it need re-order the bins after every split, which will cost much for dense feature. So we only using ordered bin for sparse situations.
◆ ConstructHistogram() [1/2]
Construct histogram by using this bin Note: Unlike Bin, OrderedBin doesn't use ordered gradients and ordered hessians. Because it is hard to know the relative index in one leaf for sparse bin, since we skipped zero bins.
- Parameters
-
leaf | Using which leaf's data to construct |
gradients | Gradients, Note:non-oredered by leaf |
hessians | Hessians, Note:non-oredered by leaf |
out | Output Result |
Implemented in LightGBM::OrderedSparseBin< VAL_T >.
◆ ConstructHistogram() [2/2]
virtual void LightGBM::OrderedBin::ConstructHistogram |
( |
int |
leaf, |
|
|
const score_t * |
gradients, |
|
|
HistogramBinEntry * |
out |
|
) |
| const |
|
pure virtual |
Construct histogram by using this bin Note: Unlike Bin, OrderedBin doesn't use ordered gradients and ordered hessians. Because it is hard to know the relative index in one leaf for sparse bin, since we skipped zero bins.
- Parameters
-
leaf | Using which leaf's data to construct |
gradients | Gradients, Note:non-oredered by leaf |
out | Output Result |
Implemented in LightGBM::OrderedSparseBin< VAL_T >.
◆ Init()
virtual void LightGBM::OrderedBin::Init |
( |
const char * |
used_indices, |
|
|
data_size_t |
num_leaves |
|
) |
| |
|
pure virtual |
Initialization logic.
- Parameters
-
used_indices | If used_indices.size() == 0 means using all data, otherwise, used_indices[i] == true means i-th data is used (this logic was build for bagging logic) |
num_leaves | Number of leaves on this iteration |
◆ Split()
virtual void LightGBM::OrderedBin::Split |
( |
int |
leaf, |
|
|
int |
right_leaf, |
|
|
const char * |
is_in_leaf, |
|
|
char |
mark |
|
) |
| |
|
pure virtual |
Split current bin, and perform re-order by leaf.
- Parameters
-
leaf | Using which leaf's to split |
right_leaf | The new leaf index after perform this split |
is_in_leaf | is_in_leaf[i] == mark means the i-th data will be on left leaf after split |
mark | is_in_leaf[i] == mark means the i-th data will be on left leaf after split |
Implemented in LightGBM::OrderedSparseBin< VAL_T >.
The documentation for this class was generated from the following file:
- External/LightGBM_2.2.3/LightGBM-2.2.3/include/LightGBM/bin.h