Compute the optimal leaf weight in XGBoost-style gradient boosting from the sum of gradients G, the sum of Hessians H of the samples in the leaf, and the L2 regularisation strength lam.
Implement solve(G,H,lam).
Returns. Return the weight as a float, w∗=−G/(H+λ).
Example 1
Input:
solve(-4.0, 3.0, 1.0)
Output:
1.0
Example 2
Input:
solve(2.0, 1.0, 3.0)
Output:
-0.5
No results yet
Run your code to check it against the examples, or submit to run every test.