Compute the XGBoost split gain from the gradient and Hessian sums of the left child (GL, HL), the right child (GR, HR) and the parent (GP, HP), with regularisation lam: 21[HL+λGL2+HR+λGR2−HP+λGP2]. There is no extra per-leaf penalty.
Implement solve(GL,HL,GR,HR,GP,HP,lam).
Returns. Return the gain as a float. The three sums are used as given, so the parent sums are not forced to equal the sum of the children, and the gain can be negative.
Example 1
Input:
solve(-2.0, 2.0, 1.0, 1.0, -1.0, 3.0, 1.0)
Output:
0.791667
Example 2
Input:
solve(3.0, 2.0, -3.0, 2.0, 0.0, 4.0, 0.0)
Output:
4.5
No results yet
Run your code to check it against the examples, or submit to run every test.