Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix: Use float64 epsilon when clipping initial probabilities in GradientBoosting #31575

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mohiuddin-khan-shiam
Copy link

Replaced np.finfo(np.float32).eps with np.finfo(np.float64).eps in sklearn/ensemble/_gb.py::_get_init_raw_predictions.

Why:

  • Predictions are promoted to float64 immediately after clipping; using a float32 epsilon (≈1e-7) was unnecessarily large.
  • Large epsilon shrank extreme probabilities (near 0 or 1), degrading log-loss and calibration, especially on well-separated classes.

Impact:

  • Higher numerical fidelity of initial raw predictions.
  • Better probability calibration and potential convergence improvements.
  • Removes obsolete “FIXME” comment.

…entBoosting

Replaced `np.finfo(np.float32).eps` with `np.finfo(np.float64).eps` in `sklearn/ensemble/_gb.py::_get_init_raw_predictions`.

Why:
* Predictions are promoted to `float64` immediately after clipping; using a `float32` epsilon (≈1e-7) was unnecessarily large.
* Large epsilon shrank extreme probabilities (near 0 or 1), degrading log-loss and calibration, especially on well-separated classes.

Impact:
* Higher numerical fidelity of initial raw predictions.
* Better probability calibration and potential convergence improvements.
* Removes obsolete “FIXME” comment.
Copy link

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: c8874a9. Link to the linter CI: here

@adrinjalali
Copy link
Member

I wonder why it was float32 to start with. Do you have an example where your abovementioned impacts are illustrated?

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

Successfully merging this pull request may close these issues.

2 participants