Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
xgboost::linear Namespace Reference

Copyright 2018-2023 by XGBoost Contributors. More...

Data Structures

struct  CoordinateParam
 
class  CoordinateUpdater
 Coordinate descent algorithm that updates one feature per iteration. More...
 
class  CyclicFeatureSelector
 Deterministic selection by cycling through features one at a time. More...
 
class  FeatureSelector
 Abstract class for stateful feature selection or ordering in coordinate descent algorithms. More...
 
class  GreedyFeatureSelector
 Select coordinate with the greatest gradient magnitude. More...
 
struct  LinearTrainParam
 
class  RandomFeatureSelector
 A random (with replacement) coordinate selector. More...
 
class  ShotgunUpdater
 
class  ShuffleFeatureSelector
 Similar to Cyclic but with random feature shuffling prior to each update. More...
 
class  ThriftyFeatureSelector
 Thrifty, approximately-greedy feature selector. More...
 

Enumerations

enum  FeatureSelectorEnum {
  kCyclic = 0 , kShuffle , kThrifty , kGreedy ,
  kRandom
}
 A set of available FeatureSelector's.
 

Functions

double CoordinateDelta (double sum_grad, double sum_hess, double w, double reg_alpha, double reg_lambda)
 Calculate change in weight for a given feature.
 
double CoordinateDeltaBias (double sum_grad, double sum_hess)
 Calculate update to bias.
 
std::pair< double, double > GetGradient (Context const *ctx, int group_idx, int num_group, bst_feature_t fidx, std::vector< GradientPair > const &gpair, DMatrix *p_fmat)
 Get the gradient with respect to a single feature.
 
std::pair< double, double > GetGradientParallel (Context const *ctx, int group_idx, int num_group, int fidx, const std::vector< GradientPair > &gpair, DMatrix *p_fmat)
 Get the gradient with respect to a single feature.
 
std::pair< double, double > GetBiasGradientParallel (int group_idx, int num_group, const std::vector< GradientPair > &gpair, DMatrix *p_fmat, int32_t n_threads)
 Get the gradient with respect to the bias.
 
void UpdateResidualParallel (Context const *ctx, bst_feature_t fidx, int group_idx, int num_group, float dw, std::vector< GradientPair > *in_gpair, DMatrix *p_fmat)
 Updates the gradient vector with respect to a change in weight.
 
void UpdateBiasResidualParallel (Context const *ctx, int group_idx, int num_group, float dbias, std::vector< GradientPair > *in_gpair, DMatrix *p_fmat)
 Updates the gradient vector based on a change in the bias.
 
 DMLC_REGISTER_PARAMETER (LinearTrainParam)
 
 DMLC_REGISTRY_LINK_TAG (updater_shotgun)
 
 DMLC_REGISTRY_LINK_TAG (updater_coordinate)
 
 DMLC_REGISTER_PARAMETER (CoordinateParam)
 
 DMLC_REGISTRY_FILE_TAG (updater_coordinate)
 
 describe ("Update linear model according to coordinate descent algorithm.") .set_body([]()
 
 DMLC_REGISTRY_FILE_TAG (updater_shotgun)
 
 describe ("Update linear model according to shotgun coordinate descent " "algorithm.") .set_body([]()
 

Detailed Description

Copyright 2018-2023 by XGBoost Contributors.

Author
Rory Mitchell

Function Documentation

◆ CoordinateDelta()

double xgboost::linear::CoordinateDelta ( double  sum_grad,
double  sum_hess,
double  w,
double  reg_alpha,
double  reg_lambda 
)
inline

Calculate change in weight for a given feature.

Applies l1/l2 penalty normalised by the number of training instances.

Parameters
sum_gradThe sum gradient.
sum_hessThe sum hess.
wThe weight.
reg_alphaUnnormalised L1 penalty.
reg_lambdaUnnormalised L2 penalty.
Returns
The weight update.

◆ CoordinateDeltaBias()

double xgboost::linear::CoordinateDeltaBias ( double  sum_grad,
double  sum_hess 
)
inline

Calculate update to bias.

Parameters
sum_gradThe sum gradient.
sum_hessThe sum hess.
Returns
The weight update.

◆ GetBiasGradientParallel()

std::pair< double, double > xgboost::linear::GetBiasGradientParallel ( int  group_idx,
int  num_group,
const std::vector< GradientPair > &  gpair,
DMatrix p_fmat,
int32_t  n_threads 
)
inline

Get the gradient with respect to the bias.

Row-wise multithreaded.

Parameters
group_idxZero-based index of the group.
num_groupNumber of groups.
gpairGradients.
p_fmatThe feature matrix.
Returns
The gradient and diagonal Hessian entry for the bias.

◆ GetGradient()

std::pair< double, double > xgboost::linear::GetGradient ( Context const *  ctx,
int  group_idx,
int  num_group,
bst_feature_t  fidx,
std::vector< GradientPair > const &  gpair,
DMatrix p_fmat 
)
inline

Get the gradient with respect to a single feature.

Parameters
group_idxZero-based index of the group.
num_groupNumber of groups.
fidxThe target feature.
gpairGradients.
p_fmatThe feature matrix.
Returns
The gradient and diagonal Hessian entry for a given feature.

◆ GetGradientParallel()

std::pair< double, double > xgboost::linear::GetGradientParallel ( Context const *  ctx,
int  group_idx,
int  num_group,
int  fidx,
const std::vector< GradientPair > &  gpair,
DMatrix p_fmat 
)
inline

Get the gradient with respect to a single feature.

Row-wise multithreaded.

Parameters
group_idxZero-based index of the group.
num_groupNumber of groups.
fidxThe target feature.
gpairGradients.
p_fmatThe feature matrix.
Returns
The gradient and diagonal Hessian entry for a given feature.

◆ UpdateBiasResidualParallel()

void xgboost::linear::UpdateBiasResidualParallel ( Context const *  ctx,
int  group_idx,
int  num_group,
float  dbias,
std::vector< GradientPair > *  in_gpair,
DMatrix p_fmat 
)
inline

Updates the gradient vector based on a change in the bias.

Parameters
group_idxZero-based index of the group.
num_groupNumber of groups.
dbiasThe change in bias.
in_gpairThe gradient vector to be updated.
p_fmatThe input feature matrix.

◆ UpdateResidualParallel()

void xgboost::linear::UpdateResidualParallel ( Context const *  ctx,
bst_feature_t  fidx,
int  group_idx,
int  num_group,
float  dw,
std::vector< GradientPair > *  in_gpair,
DMatrix p_fmat 
)
inline

Updates the gradient vector with respect to a change in weight.

Parameters
fidxThe feature index.
group_idxZero-based index of the group.
num_groupNumber of groups.
dwThe change in weight.
in_gpairThe gradient vector to be updated.
p_fmatThe input feature matrix.