Select coordinate with the greatest gradient magnitude.
More...
#include <coordinate_common.h>
|
void | Setup (Context const *, const gbm::GBLinearModel &model, const std::vector< GradientPair > &, DMatrix *, float, float, int param) override |
| Setting up the selector state prior to looping through features.
|
|
int | NextFeature (Context const *ctx, int, const gbm::GBLinearModel &model, int group_idx, const std::vector< GradientPair > &gpair, DMatrix *p_fmat, float alpha, float lambda) override |
| Select next coordinate to update.
|
|
| FeatureSelector ()=default |
|
virtual | ~FeatureSelector ()=default |
| virtual destructor
|
|
|
bst_uint | top_k_ |
|
std::vector< bst_uint > | counter_ |
|
std::vector< std::pair< double, double > > | gpair_sums_ |
|
Select coordinate with the greatest gradient magnitude.
- Note
- It has O(num_feature^2) complexity. It is fully deterministic.
-
It allows restricting the selection to top_k features per group with the largest magnitude of univariate weight change, by passing the top_k value through the
param
argument of Setup(). That would reduce the complexity to O(num_feature*top_k).
◆ NextFeature()
int xgboost::linear::GreedyFeatureSelector::NextFeature |
( |
Context const * |
ctx, |
|
|
int |
iteration, |
|
|
const gbm::GBLinearModel & |
model, |
|
|
int |
group_idx, |
|
|
const std::vector< GradientPair > & |
gpair, |
|
|
DMatrix * |
p_fmat, |
|
|
float |
alpha, |
|
|
float |
lambda |
|
) |
| |
|
inlineoverridevirtual |
Select next coordinate to update.
- Parameters
-
ctx | Booster context |
iteration | The iteration in a loop through features |
model | The model. |
group_idx | Zero-based index of the group. |
gpair | The gpair. |
p_fmat | The feature matrix. |
alpha | Regularisation alpha. |
lambda | Regularisation lambda. |
- Returns
- The index of the selected feature. -1 indicates none selected.
Implements xgboost::linear::FeatureSelector.
◆ Setup()
Setting up the selector state prior to looping through features.
- Parameters
-
ctx | The booster context. |
model | The model. |
gpair | The gpair. |
p_fmat | The feature matrix. |
alpha | Regularisation alpha. |
lambda | Regularisation lambda. |
param | A parameter with algorithm-dependent use. |
Reimplemented from xgboost::linear::FeatureSelector.
The documentation for this class was generated from the following file: