Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining a callback to write hessians of train observations to a csv file #10144

Open
jaguerrerod opened this issue Mar 23, 2024 · 2 comments
Open

Comments

@jaguerrerod
Copy link

jaguerrerod commented Mar 23, 2024

I would like to inspect the distribution of gradients and hessians during training to understand the impact of the min_child_weight parameter on the split process. Is there a way to define a callback for this using the R interface?

@trivialfis
Copy link
Member

I think you need to define a custom objective for that.

@jaguerrerod
Copy link
Author

jaguerrerod commented Mar 24, 2024

That's the way when it's possible to define the gradient and hessian within a function, but my issue is with the use of rank:pairwise, where I cannot calculate them within a customizable objective function.
I have no idea about the ranges in which gradients and hessians fluctuate, and therefore, I'll have no choice but to try the regularization parameters alpha, lambda, and min_child_weight with a logarithmic scale to efficiently cover a wide range.
It would be interesting to have certain objects available to use within the callbacks, such as in this case the array of gradients and hessians.
Another idea I've been considering for some time is to use a split selection criterion based on efficiency, defined not only by gain but also by how the cover of the parent node is divided by said split.
In the case of two similar gains, I prefer to split the node into two parts of the most similar size, so the imbalance of the sizes of the child nodes can be included as a penalty to the gain.
This is interesting when the signal in the data is very small and the noise is large, so the estimates of the values of the leaves with small size are unstable. This strategy complements the use of relatively large min_child_weight.
To experiment with this, I would need information about the candidates for split points along with their respective gains and the cover of the child nodes they generate.
Anyway, for now, I'll focus on optimizing the available parameters, but enabling more information for the callback could be an interesting way of experimentation without needing to modify the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants