Skip to contents

Gain = 0.5 [GL^2/(HL+l) + GR^2/(HR+l) - G^2/(H+l)] - gamma; a negative gain means prune.

Usage

morie_geron_xgboost_gain(GL, HL, GR, HR, lam = 1, gamma = 0)

Arguments

GL, HL, GR, HR

Gradient and Hessian sums per child.

lam

Non-negative L2 leaf penalty.

gamma

Non-negative split cost.

Value

List with gain, left_score, right_score, parent_score, left_weight, right_weight, should_split.

Examples

morie_geron_xgboost_gain(3, 2, -1, 1.5, lam = 1, gamma = 0.2)
#> $gain
#> [1] 1.055556
#> 
#> $left_score
#> [1] 3
#> 
#> $right_score
#> [1] 0.4
#> 
#> $parent_score
#> [1] 0.8888889
#> 
#> $left_weight
#> [1] -1
#> 
#> $right_weight
#> [1] 0.4
#> 
#> $should_split
#> [1] TRUE
#> 
#> $estimate
#> [1] 1.055556
#> 
#> $n
#> [1] 2
#>