Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
xgboost::linear::GreedyFeatureSelector Class Reference

Select coordinate with the greatest gradient magnitude. More...

#include <coordinate_common.h>

Inheritance diagram for xgboost::linear::GreedyFeatureSelector:
xgboost::linear::FeatureSelector

Public Member Functions

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
 
- Public Member Functions inherited from xgboost::linear::FeatureSelector
virtual ~FeatureSelector ()=default
 virtual destructor
 

Protected Attributes

bst_uint top_k_
 
std::vector< bst_uintcounter_
 
std::vector< std::pair< double, double > > gpair_sums_
 

Additional Inherited Members

- Static Public Member Functions inherited from xgboost::linear::FeatureSelector
static FeatureSelectorCreate (int choice)
 factory method
 

Detailed Description

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

Member Function Documentation

◆ 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
ctxBooster context
iterationThe iteration in a loop through features
modelThe model.
group_idxZero-based index of the group.
gpairThe gpair.
p_fmatThe feature matrix.
alphaRegularisation alpha.
lambdaRegularisation lambda.
Returns
The index of the selected feature. -1 indicates none selected.

Implements xgboost::linear::FeatureSelector.

◆ Setup()

void xgboost::linear::GreedyFeatureSelector::Setup ( Context const *  ,
const gbm::GBLinearModel ,
const std::vector< GradientPair > &  ,
DMatrix ,
float  ,
float  ,
int   
)
inlineoverridevirtual

Setting up the selector state prior to looping through features.

Parameters
ctxThe booster context.
modelThe model.
gpairThe gpair.
p_fmatThe feature matrix.
alphaRegularisation alpha.
lambdaRegularisation lambda.
paramA parameter with algorithm-dependent use.

Reimplemented from xgboost::linear::FeatureSelector.


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